+ 1
Is this Wrong - if ( int = 2 ) { cout <<"bla bla bla bla \n"; }
4 odpowiedzi
+ 2
Yes, it's wrong.
int,float,etc. , i.e. datatypes and keywords, can't be used as the name of an identifier.
Also, you have used assignment operator where you should have used == operator. So your condition will always return true.
use if(number==2) or something similar instead.
+ 2
yes, it is wrong. because in if condition, you should use conditional operator == not assignment operator =.okay
+ 1
thanks
0
it's wrong because with if conditions we use "==" Not "=" and we dont use type of variable like you Do
the correct syntaxe is
if(variable_Name == 2){cout <<"blablabla"<<endl;