0

question on variables

#include <iostream> using namespace std; int main() { int a int b a=b=30 int sum = a + b; cout << sum; return 0; } whats wrong with this ? plz give me some help, thx

5th Jul 2017, 5:32 AM
mobeimo
2 Antworten
+ 7
Yep, just semicolons missing.
5th Jul 2017, 6:23 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
You forgot the ';' after lines : 6, 7, 8. Try to look at the errors displays un the console : When it says:"int main() : 7 : 12 : error expected ';' before 'int'" You can fine the number of the line: here 7 and the error: "expected... before 'int'" This code outputs 60 a=b=30; so a=30 b=30 30+30=60.
5th Jul 2017, 5:58 AM
Jojo