int a;
cin >> a;
if(a== 2) { // btw do I need to single quote '2'
a=3;
}
else{
a=5;
}
int c=a+2;
cout << c;
And what I want it to do is this: if the user input is 2 then a is assigned to 3
otherwise a is assigned to 5. And c will be either 3+2=5 or 5+2=7. But the problem is this: no matter what input it is, the c is always 7. It's 7 even when 2 is input. Why is that?