+ 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; }
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
+ 11
It was little mistake first try to solve by self . It u are unable to solve than post in discussion box.
+ 3
You need to add an extra } to the end of your code. This is to close the main() function.
+ 2
Thanks I find my mistake that I forgot to close the else curly brackets
+ 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 đ
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;
}
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;
}