Why does it crash ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does it crash ?

#include <iostream> using namespace std; int main () int var (a = 0; a < 50; a+=10) { cout << a << endl; } int x[2][3] = { {2, 3, 4}, // 1st row {8, 9, 10} // 2nd row };break /* Outputs 0 10 20 30 40 *

22nd Apr 2017, 3:33 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
5 Answers
+ 9
I think this is how it should be: #include <iostream> using namespace std; int main(){ for(int a=0; a<50; a+=10){ cout << a << endl; } return 0; } This code produces the expected output.
22nd Apr 2017, 3:56 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
the { after main is missing and the closing } of main is missing
22nd Apr 2017, 3:37 PM
Jasper ten Hove
Jasper ten Hove - avatar
0
thx :')
22nd Apr 2017, 3:40 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
0
did it work?
22nd Apr 2017, 3:40 PM
Jasper ten Hove
Jasper ten Hove - avatar
0
yes but if you wabt to practice with array the original code is good only missing {}
22nd Apr 2017, 4:18 PM
Jasper ten Hove
Jasper ten Hove - avatar