cin >> a;
for(int b; b=1; b--);
b = a; The b is already declare once at the first of the function; you seem to declare it again which cause the syntax error. Moreover, you failed to usefor loop. Here is the syntax of for loop: for( initialization, condition, increasement/decreasement ). In the condition part, you use = (assign operator) instead of == (equalition). In this case, you are experience the infinitive loop because b variable is always 1 (all the non-zero integers are true, zero mean false). Remember, the for loop keep looping until the condition became false. If your condition is always true, then it will loop endlessly.
b = 1;
cin >> a;
for ( ; a > 0; a--)
b *= a; This would solve your problem, but you might ask me why I would write like this? where is my initialization? a variable recieves the input of the user to perform the calculation, which is my initialization.a > 0, this is my condition, I tell my program to loop until a's value is 0 or smaller than 0. a--, is my decreasement.
(Sorry, I was forgetten to initialize b=1 and to change = to *=)