+ 1
How do fix a compilation error?
it just comes up expecially when i run a code which requires multiple inputs.
5 Respostas
+ 2
Please show me the code which has the problem.
+ 2
the last two “<<“ are backward for the couts
+ 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
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;
}
0
therz the simplest one