+ 3

Why do I get 'expected primary expression' error on if statement?

I have this weird problem with my program, here is the code: char a; std::cin >> a; if (a !== "") //do something In the if statement, I get the error 'expected primary expression' before the second equals sign. Why?

8th Sep 2018, 3:43 PM
jacksonofgames 28
jacksonofgames 28 - avatar
2 ответов
+ 6
First, the 'not equal to' is not !==. 'not equal to' must be !=. Another error, you declared a as char but double quotation mark only use for string. You must use single quotation mark like this: a!='c'
8th Sep 2018, 4:05 PM
LetterC67
LetterC67 - avatar
0
Thank you!
9th Sep 2018, 6:24 PM
jacksonofgames 28
jacksonofgames 28 - avatar