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

Why does my code not execute

It opens but then closes instantly

12th Aug 2018, 6:26 PM
Ilyane
11 Answers
+ 1
Can you give the code?
12th Aug 2018, 6:29 PM
Théophile
Théophile - avatar
+ 1
yes
12th Aug 2018, 6:29 PM
Ilyane
0
#include <iostream> using namespace std; int main() { cout << “calculator\n\n”; int a = 12 ; int b = 13 ; int sum = a + b; cout << “pls select num\n\n”; cin a; cout << “pls select num\n\n”; cin b; cout << sum; return 0;
12th Aug 2018, 6:34 PM
Ilyane
0
}
12th Aug 2018, 6:35 PM
Ilyane
0
cin >> a; You forget >>
12th Aug 2018, 6:37 PM
B K
0
wait sorry i added those in just phone typing error
12th Aug 2018, 6:38 PM
Ilyane
0
but still not working
12th Aug 2018, 6:39 PM
Ilyane
0
Why you input a and b after they do nothing with sum?
12th Aug 2018, 6:39 PM
B K
0
starts for one sec then closes
12th Aug 2018, 6:39 PM
Ilyane
0
try system("pause"); before return 0; or try to delete exe file and compile again.
12th Aug 2018, 6:40 PM
B K
0
thatnks so much
12th Aug 2018, 11:04 PM
Ilyane