Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Students{
- private:
- string name;
- int age;
- public:
- Students(string n,int a){
- name = n;
- age = a;
- }
- string gName(){
- return name;
- }
- int gAge(){
- return age;
- }
- void constant1(){
- cout << "The student's name is : ";
- }
- void constantMale(){
- cout << " , and his age is : ";
- }
- void constantFemale(){
- cout << " , and her age is : ";
- }
- void barrier(){
- cout <<"-----------------------------------------------------" << endl;
- }
- };
- int main()
- {
- Students c1("Mohanad",16);
- Students c2("Rada",17);
- Students c3("Syne",18);
- c1.constant1();
- cout << c1.gName();
- c1.constantMale();
- cout << c1.gAge() << endl;
- c1.barrier();
- c2.constant1();
- cout << c2.gName();
- c2.constantFemale();
- cout << c2.gAge() << endl;
- c2.barrier();
- c3.constant1();
- cout << c3.gName();
- c3.constantMale();
- cout << c3.gAge() << endl;
- c3.barrier();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement