0

Another Question about C++

Hello again, sorry I am a beginner, here is my code #include <iostream> using namespace std; int main() { string name; int age; string Lname; cout << "Enter your name" << endl; cin >> name; cout<<name<<endl; cout << "Enter your last name" << endl; cin >> Lname; cout<<Lname<<endl; cout << "Enter your age" << endl; cin >> age; cout<<age<<endl; } I want to add an if statement where it says if age=> 15 && age<== 65 then you are still athletic and you rock. else go exercise Thank you for helping

6th Jun 2018, 1:54 AM
Sai Manikandan
Sai Manikandan - avatar
2 odpowiedzi
+ 1
[ EXTRA - Add #include<string> ] erase - cout << age << endl; write - if(age>=15 && age<=65) { cout << " You are still athletic and you rock " ; } else { cout << " Go exercise " ; }
6th Jun 2018, 2:03 AM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar
+ 1
Thanks, it works!
7th Jun 2018, 3:45 AM
Sai Manikandan
Sai Manikandan - avatar