Here is a sample program that will ask the user to give his or her age and then our program will check and determine if the user is an already an adult or still a minor using classes in C++.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
#include <iostream>
using namespace std;
class age {
int ages;
public:
int getdata();
void display(void);
};
int age:: getdata()
{
cout << "Enter the age of the person : ";
cin >> ages;
if (ages >= 18) {
cout <<"\n The person is Already an Adult.";
}
else
{
cout <<"\n The person is Still a Minor.";
}
cout << "\n\n";
system("pause");
}
void age:: display(void)
{
int value;
value = getdata();
}
main()
{
age start;
start.display();
}
No comments:
Post a Comment