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
2 Antworten
+ 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 " ;
}
+ 1
Thanks, it works!