Can someone tell me what is wrong in this code? when I run it it shows error! I tried several times but it shows error plz help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone tell me what is wrong in this code? when I run it it shows error! I tried several times but it shows error plz help

#include <iostream> using namespace std; int main(){ int age; int money; cin >> age; cin >> money; if (age > 18 && money > 1000000){ cout << "you are billoniare " << endl << "coool"; }else{ cout << "you are a normal man" << endl; return 0; }

11th Jul 2020, 6:20 AM
Pooja Agrawal
Pooja Agrawal - avatar
7 Answers
+ 11
Pooja Agrawal as Rowsej said you have forgot to close the parenthesis and semicolon.. You can refer this once https://code.sololearn.com/cmUZgq2ESio7/?ref=app
11th Jul 2020, 6:26 AM
Aditya
Aditya - avatar
+ 11
It was little mistake first try to solve by self . It u are unable to solve than post in discussion box.
11th Jul 2020, 6:32 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
You need to add an extra } to the end of your code. This is to close the main() function.
11th Jul 2020, 6:23 AM
Rowsej
Rowsej - avatar
+ 2
Thanks I find my mistake that I forgot to close the else curly brackets
11th Jul 2020, 8:05 AM
Pooja Agrawal
Pooja Agrawal - avatar
+ 2
The code is wrong on were it says : Cout<<"you are billionaire " <<endl<<"cool"; Because (endl) in English stands for end line when translated to c++ so you are not supposed to use endl in between your code but in stead you must use it like this Cout <<"you are billionaire "<<"cool"<<endl; Note endl line stands for (end line) Note the is a semicolon at the end of endl let's say you wanted to write some text on the next line using the same line you can use the "\n " to move to another line note : "\n" stands for new line hope it helps pls upvote 😁
11th Jul 2020, 11:45 PM
Pjc
Pjc - avatar
0
#include <iostream> using namespace std; int main(){ int age; int money; cin >> age; cin >> money; if (age > 18 && money > 1000000){ cout << "you are billoniare " << endl << "coool"; }else{ cout << "you are a normal man" << endl; } return 0; }
11th Jul 2020, 6:26 AM
Shobhith J B
Shobhith J B - avatar
0
#include <iostream.h> using namespace std; int main(){ int age; int money; cin >> age; cin >> money; if (age > 18 && money > 1000000){ cout << "you are billoniare " << endl << "coool"; }else{ cout << "you are a normal man" << endl; } return 0; }
11th Jul 2020, 6:45 AM
Dilip . K. N
Dilip . K. N - avatar