BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/300-object-oriented-programming/)
-   -   Program to enter your age and print if you should be in grade 10 (http://bzupages.com/f300/program-enter-your-age-print-if-you-should-grade-10-a-14553/)

bonfire 01-03-2011 02:25 PM

Program to enter your age and print if you should be in grade 10
 
1 Attachment(s)
#include
#include

void main()
{
clrscr();
int age;
cout << "Enter your present age : " << endl;
cin>>age;
if(age==16)
{
cout << "Your present age is " << age << " years." << endl;
cout << "You are of the right age for joining grade 10 !" << endl;
}
else
{
cout << "Your present age is " << age << " years." << endl;
cout << "You are not of the right age for joining grade 10 !" << endl;
}
getch();
}
This program takes in the age as a screen input from the user.
The program tells the user whether he/she should be in grade 10 or not by using the 'IF-ELSE' command.
It then prints out the appropriate message using the 'cout' command.
SAMPLE INPUT
15

SAMPLE OUTPUT
Your present age is 15 years.
You are not of the right age for joining grade 10 !


All times are GMT +5. The time now is 06:11 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.