Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

expected expression error in c++

EricHofmann11
EricHofmann11

I am trying to create a program that will simply do calculations. However, when I try to prevent the user from inputting '' instead of '/'. I get the error message "if (opsign == '') expected expression ^

2 years ago

Voters

Comments

TopNew
1
SixBeeps
SixBeeps

The backslash is used for escaping characters in most languages. If you want to enter a backslash character in a string, you have to escape it (effectively escaping the thing that's used for escaping):

printf("\\"); // This outputs one backslash
2 years ago
1
EricHofmann11
EricHofmann11

@SixBeeps
could you please help me with my updated program? after I implemented your form of the forward slash, my next assignment was to use the same program, but with a switch statement. Once I did so, I started to get another error message saying multiple definitions of main.

2 years ago
Load more