+ 1

What's wrong in that part of code?

What's wrong in that part of code? If (howare == 1); { cout << "\n 1"; } Error: ..\Playground\: In function 'int main()': ..\Playground\:10:24: error: 'If' was not declared in this scope If (howare == 1); { ^

31st Oct 2016, 12:03 PM
Junior
Junior - avatar
6 Antworten
+ 9
Delete ; after if
31st Oct 2016, 12:03 PM
Remmae
Remmae - avatar
+ 4
Also, the 'I' in 'If' is upper-case, it should be lower.
31st Oct 2016, 3:42 PM
Liam
Liam - avatar
+ 2
if must be lower case, main return an int, so mybee you add return 0;
31st Oct 2016, 10:42 PM
M'hamed Hicham RAHIMI
M'hamed Hicham RAHIMI - avatar
0
Now I got that: ..\Playground\: In function 'int main()': ..\Playground\:10:24: error: 'If' was not declared in this scope If (howare == 1) { ^ ..\Playground\:10:26: error: expected ';' before '{' token If (howare == 1) { ^ Bigger part of code: int main() { int howare; cout << "Hello!"; cin >> howare; cout << "\n 1 \n 2 \n 3"; If (howare == 1) { cout << "\n 1"; }
31st Oct 2016, 12:12 PM
Junior
Junior - avatar
0
post the whole code please
31st Oct 2016, 1:14 PM
Malvern Panashe Mhepo
Malvern Panashe Mhepo - avatar
0
Liam, thanks! ;D
31st Oct 2016, 3:56 PM
Junior
Junior - avatar