0
Why if I write this code :
#include <iostream> using namespace std; int main() { int a; cin>>a; if (a='Hi'){ cout<<"Hi"; } else { cout<<"Norm"; } return 0; }
3 ответов
+ 2
Use == instead of = in the if condition. = is used for assignment of variables while == to compare values.
+ 1
If parameter should contains Boolean expression
As told by TurtleShell , you have to use == instead of =
a=="Hi" is a Boolean expression
a="Hi" is not
0
Why error?