Syvum Home Page

Home > Quiz Games > C++ Programming > Print Preview

C++ Programming : Program 5-A

Program to enter your age and print if you should be in grade 10


 

#include <iostream.h>
#include <conio.h>

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.

15

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

Index of C++ Programs
 

-
-
 
45 more pages in C++ Programming

Contact Info © 1999-2024 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright