Write a program that checks the age of a user (C++ Programming)
// Required C++ code:
#include <bits/stdc++.h>
using namespace std;
int main(){
int age; // declaring variable
cout<<"Please Enter your age: ";
cin>>age; //reading user input of age
if(age>=18 && age<=20){ //checking if
age is between 18 to 20
cout<<"Sing a song";
}else
if(age<18){ //checking
if age less than 18
cout<<"Please show a dance
step";
}else{
cout<<"You are audience";
//printing required statement
}
return 0;
}
OUTPUT:
Hope this helped. Please do upvote and if there are any queries please ask in the comments section.
Get Answers For Free
Most questions answered within 1 hours.