C++ Programming Blog

 
 
 

Image

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

 const int length=50;


 //------------------------------  student  ------------------------------//


 class student
    {
       private:
        char school[length];
        char degree[length];

       public:
        void get_education();
        void show_education();
    };



 //------------------------------  employee  -----------------------------//


 class employee
    {
       private:
        char name[length];
        char id_number[length];

       public:
        void get_identification();
        void show_identification();
    };


 //------------------------------  manager  ------------------------------//


 class manager
    {
       private:
        char title[length];
        double club_dues;

        student stu;
        employee emp;

       public:
        void get_data();
        void show_data();
    };


 //------------------------------  scientist  ----------------------------//


 class scientist
    {
       private:
        int publications;

        student stu;
        employee emp;

       public:
        void get_data();
        void show_data();
    };


 //------------------------------  labour  -------------------------------//


 class labour
    {
       private:
        employee emp;

       public:
        void get_data();
        void show_data();
    };



 //-----------------------  get_education( )  ----------------------------//


 void student::get_education()
    {
       cout<<\"\\t Enter the School Name : \";
       gets(school);

       cout<<\"\\t Enter the highest Degree earned : \";
       gets(degree);
    }


 //-----------------------  show_education( )  ---------------------------//


 void student::show_education()
    {
       cout<<\"\\t School Name : \"<<school<<endl;
       cout<<\"\\t Highest Degree earned : \"<<degree<<endl;
    }



 //---------------------------  employee  --------------------------------//




 //----------------------  get_identification( )  ------------------------//


 void employee::get_identification()
    {
       cout<<\"\\t Enter the Name : \";
       gets(name);

       cout<<\"\\t Enter the ID Number : \";
       gets(id_number);
    }


 //----------------------  show_identification( )  -----------------------//


 void employee::show_identification()
    {
       cout<<\"\\t Name : \"<<name<<endl;
       cout<<\"\\t ID Number : \"<<id_number<<endl;
    }



 //----------------------------  manager  --------------------------------//




 //----------------------------  get_data( )  ----------------------------//


 void manager::get_data()
    {
       emp.get_identification();

       cout<<\"\\t Enter the Title : \";
       gets(title);

       cout<<\"\\t Enter the Club Dues : \";
       cin>>club_dues;

       stu.get_education();
    }


 //----------------------------  show_data( )  ---------------------------//


 void manager::show_data()
    {
       emp.show_identification();

       cout<<\"\\t Title : \"<<title<<endl;
       cout<<\"\\t Club Dues : \"<<club_dues<<endl;

       stu.show_education();
    }



 //----------------------------  scientist  ------------------------------//




 //----------------------------  get_data( )  ----------------------------//


 void scientist::get_data()
    {
       emp.get_identification();

       cout<<\"\\t Enter the Number of Publications : \";
       cin>>publications;

       stu.get_education();
    }


 //---------------------------  show_data( )  ----------------------------//


 void scientist::show_data()
    {
       emp.show_identification();

       cout<<\"\\t Number of Publications : \"<<publications<<endl;

       stu.show_education();
    }



 //-----------------------------  labour  --------------------------------//




 //----------------------------  get_data( )  ----------------------------//


 void labour::get_data()
    {
       emp.get_identification();
    }


 //---------------------------  show_data( )  ----------------------------//


 void labour::show_data()
    {
       emp.show_identification();
    }


 main()
    {
       clrscr();

       manager m;
       scientist s;
       labour l;

       cout<<\"\\n *********  Manager  *********\"<<endl;
       m.get_data();

       cout<<\"\\n *********  Scientist  ********\"<<endl;
       s.get_data();

       cout<<\"\\n *********  Labour  ********\"<<endl;
       l.get_data();

       getch();
       clrscr();

       cout<<\"\\n *********  Manager  *********\"<<endl;
       m.show_data();

       cout<<\"\\n *********  Scientist  ********\"<<endl;
       s.show_data();

       cout<<\"\\n *********  Labour  ********\"<<endl;
       l.show_data();

       getch();
       return 0;
    }

    Related Post:
  1. Program to illusrate data conversion user defined data types using functions

  2. Program to calculate distance summation, subtraction, multiplication and comparison using overloading operators also make it friend functions

  3. Program of tower of hanoi

  4. Program to represent or compress \‘2ABCDE to string \‘AABCDE\’

  5. Double Linked List-C++

  6. Program to show the 3D Reflection Transformation along xy-plane

  7. Program to illustrate printing data on the printer

  8. Program that differentiate b/w the variables of the storage class Auto and Static along with global variables

  9. Program that takes input of vector elements and performs multiplication operation, and input/output (&gt;&gt;, &lt;&lt;) using operator overloading

  10. Program to print a diamond

  11. Program to estimate the value of Third Derivative of the function at the given points from the given data using Central Difference Formula of order 2

  12. Program to convert an Infix Expression into a Postfix / Suffix Expression without parenthesize

  13. Program to find largest integer among the three and display it using function with no return type

  14. Program that provides facilities of calculator in c++

  15. Program that provides an example of scope resolution operator

  16. Program of parser 1

  17. Program to illustrate multiple inheritance

  18. Program that take font and background color and text input from a user and display it in center aligned

  19. Program to implement the Prims Algorithm to solve Minimum Spanning Tree Problem (MST) using Graphics and with Mouse support

  20. Program to illustrate the use of inline functions

 
 
Didn't find what you were looking for? Find more on Program to illustrate an example of containership