+ 1

How do fix a compilation error?

it just comes up expecially when i run a code which requires multiple inputs.

15th Jun 2018, 8:24 AM
Anthony Omary
Anthony Omary - avatar
5 odpowiedzi
+ 2
Please show me the code which has the problem.
15th Jun 2018, 8:31 AM
Disvolviĝo;
Disvolviĝo; - avatar
+ 2
the last two “<<“ are backward for the couts
15th Jun 2018, 9:28 AM
Lividcoder
Lividcoder - avatar
+ 1
Anthoney Omy you are adding two noninitialized variables, you should add them after you have read the input into them. sum wouldn‘t contain the sum of your two inputs since they are read after you assigned a+b to sum
15th Jun 2018, 9:02 AM
Max
Max - avatar
0
#include <iostream> using namespace std; int main() { int a,b; int sum=a+b; cout<<"what is the first number?\n\n"; cin>>a; cout>>"and the second?\n\n"; cin>>b; cout>>"\ntheir sum is:">>sum; return 0; }
15th Jun 2018, 8:34 AM
Anthony Omary
Anthony Omary - avatar
0
therz the simplest one
15th Jun 2018, 8:34 AM
Anthony Omary
Anthony Omary - avatar