0
I need help, i dont know where the error is
#include <iostream> using namespace std; int main() { int a, b; int suma; cout << "ingresa el valor de a \n"; cin >> a; cout << "ingrese el valor de b \n"; cin >> b; suma = a + b; cout <<"la suma es: " <<suma <<endl; return 0; }
4 Antworten
+ 7
0-kool ,
if your code will be used in a code coach exercise (sololearn tutorial), you should be aware that no inputs or outputs can be done except the ones that are demanded. [EDITED: i suppose you are trying to do exercice 6.2 in c++ tutorial]
▪︎this means that you should comment out the lines that gives a user prompt for inputting the 2 values.
▪︎also rework the final output of the result by removing the string
...
int a, b;
int suma;
//cout << "ingresa el valor de a \n"; // <<<
cin >> a;
//cout << "ingrese el valor de b \n"; // <<<
cin >> b;
suma = a + b;
cout <<suma <<endl; // <<<
...
happy coding and good success!
+ 3
Seems to work just fine.
+ 2
There is no problem as I see it. What input did you give for <a> and <b>?
Here's a guide to providing input in Code Playground
https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
P.S. Please include a relevant language C++ in the tags above, where it says "suma" ☝
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 2
Thank you very much i can descover the problem