+ 2
What's wrong?! Please! Help me!!
What's wrong with this code?!! I can't understand... #include <iostream> using namespace std; int main () { int a; int b; int sum; cout <<"Introduceti valorea numarului dorit: \n"; cout <<"a="; cin >> a; cout <<"Acum introduceti si cea de-a doua valoare: \n b="; cin >> b; cout << "Doriti sa efectuam suma celor doua? Bineinteles ca doriti! Suma dumneavoastra este:"; sum = a+b; cout << sum; cout << "Sper ca sunteti multumiti de programul/codul meu! :)"; return 0; } It says I need to add an input and split the code in parts. What does it mean?
13 Respostas
+ 3
line 8 you forgot ';'
+ 3
Thanks Jamie and Jojo!
+ 2
Thanks a lot, Jamie!đ
+ 2
//Corrected Code with Better Formatting
#include <iostream>
using namespace std;
int main ()
{
int a;
int b;
int sum;
cout <<"\n \n Introduceti valorea numarului dorit:";
cin >> a;
cout <<"\n \n Acum introduceti si cea de-a doua valoare:";
cin >> b;
cout << "\n\n Doriti sa efectuam suma celor doua? Bineinteles ca doriti! \n Suma dumneavoastra este:";
sum = a+b;
cout << sum;
cout << "\n\n Sper ca sunteti multumiti de programul/codul meu! :)";
return 0;
}
+ 1
What's "\t"?
+ 1
Thanks again, Jamie!
+ 1
But now it says I need an input and to spit it in parts. And instead to let me put what value I want, there are some numbers.
What should I do?!
+ 1
Balachandar, haven't you to add cout<<a; cout<<b;?
0
What's wrong!?!?!? YOU'RE FREAKING OUT!
- 1
//corrected
#include <iostream>
using namespace std;
int main ()
{
int a;
int b;
int sum;
cout <<"Introduceti valorea numarului dorit: \n"
;
cout <<"a=";
cin >> a;
cout <<"Acum introduceti si cea de-a doua valoare: \n b=";
cin >> b;
cout << "Doriti sa efectuam suma celor doua? Bineinteles ca doriti! Suma dumneavoastra este:\t";
sum = a+b;
cout << sum << endl;
cout << "Sper ca sunteti multumiti de programul/codul meu! :)";
return 0;
}