What's wrong?! Please! Help me!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

5th Jul 2017, 6:17 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
10 Answers
+ 3
line 8 you forgot ';'
5th Jul 2017, 6:05 PM
Jojo
+ 3
Thanks Jamie and Jojo!
5th Jul 2017, 6:17 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
+ 2
Thanks a lot, Jamie!😃
5th Jul 2017, 7:36 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
+ 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; }
6th Jul 2017, 12:49 PM
balachandar karnan
balachandar karnan - avatar
+ 1
What's "\t"?
5th Jul 2017, 6:51 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
+ 1
Thanks again, Jamie!
5th Jul 2017, 7:15 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
+ 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?!
5th Jul 2017, 7:18 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
+ 1
Balachandar, haven't you to add cout<<a; cout<<b;?
6th Jul 2017, 3:35 PM
MintyNerdyPoodle
MintyNerdyPoodle - avatar
0
What's wrong!?!?!? YOU'RE FREAKING OUT!
5th Jul 2017, 6:08 PM
AgentSmith
- 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; }
5th Jul 2017, 6:35 PM
‎ ‏‏‎Anonymous Guy