Practice # 9.1
Here we discuss about selection structure where in use if else-if else ladder. And we make a small program of a theme park entry system to use the if else-if else ladder in selection structure. I have given the output image below. Probably it will be cool for you. I have also given the full program source code down there. You can check the previous practices, if you will don't understand anything on this blog for getting knowledge. And also you can contact me any further knowledge.
#include<iostream>
#include<iomanip>
using namespace std;
// Here we discuss about Selection Structure
//Selection Structure
int main() {
int age;
float height;
// here '\t' is use for tab and its a manipulator
cout<<"\t\t\t\tWellcome To The COOL 'N' COOL Theme Park"<<endl<<endl;
cout<<"Enter your Age in Years"<<endl;
cin>>age;
cout<<"Enter your Height in Feet"<<endl;
cin>>height;
float length=height * 30.48f;
if((age>=3 && age<=5) && (length>=70 && length<=90))
{
cout<<"\t\t\t\tHave Fun Enter the COOL 'N' COOL Park and Play in Toddler Area";
}
else if (age<3)
{
cout<<"\t\t\t\tSorry You are not Enter the Park. You are a small baby";
}
else if ((age>=5 && age<=10) && (length>=90 && length<=120))
{
cout<<"\t\t\t\tHave Fun Enter the COOL 'N' COOL Park and Play in SoftPlay Area";
}
else if ((age>=3 && age<=80) && (length>=75 && length<=180))
{
cout<<"\t\t\t\tHave Fun Enter the COOL 'N' COOL Theme Park ";
}
else if ((age>=81 && age<=100) && (length>=75 && length<=250))
{
cout<<"\t\t\t\tBe Carefull and Be Aware and Have Fun in COOL 'N' COOL Theme Park ";
}
else
{
cout<<"Please Contact to the Park Atandent ";
}
return 0;
}

Comments
Post a Comment