C program to create, update & display account & admin, C/C++ Programming

Aim: To implement a program to create, update & display account & admin record of person using display account & admin records of person using virtual base class..

Code:                      

class person

{

            int code;

            char name[20];

            public:

            void getdata();

            void displaydata();

};

class account: public virtual person

{

            int pay;

            public:

            void getdata();

            void displaydata();

};

 

class admin : public virtual person

{

            int experience;

            public:

            void getdata();

            void displaydata();

};

 

class master : account, admin

{

            public:

            void getdata();

            void displaydata();

};

 

void person::getdata()

{

            cout<<"\nCode: ";

            cin>>code;

            cout<<"Name: ";

            cin>>name;

}

void account::getdata()

{

            cout<<"Enter Pay: ";

            cin>>pay;

}

void admin::getdata()

{

            cout<<"Enter Experience: ";

            cin>>experience;

}

void master::getdata()

{

            person::getdata();

            account::getdata();

            admin::getdata();

}

 

void person::displaydata()

{

            cout<<"\nEmployee code: "<

            cout<<"\nName: "<

}

void admin::displaydata()

{

            cout<<"\nExperience: "<

}

void account::displaydata()

{

            cout<<"\nPay: Rs."<

}

void master::displaydata()

{

            person::displaydata();

            account::displaydata();

            admin::displaydata();

}

 

void main()

{

            int ch;

            clrscr();

            master m1;

            cout<<"\n\tEnter Details:";

            m1.getdata();

            cout<<"\n\t**Details Registered Successfully**\n\n";

            m1.displaydata();

            getch();

}

 

Output:

        Enter Details:

Code: 312

Name: Bella

Enter Pay: 320$

Enter Experience: 2

        **Details Registered Successfully**

Employee code: 312

Name: Bella

Pay: 320$

Experience: 2 years

Posted Date: 9/29/2012 4:11:14 AM | Location : United States







Related Discussions:- C program to create, update & display account & admin, Assignment Help, Ask Question on C program to create, update & display account & admin, Get Answer, Expert's Help, C program to create, update & display account & admin Discussions

Write discussion on C program to create, update & display account & admin
Your posts are moderated
Related Questions

Why many companies are switching their current business language to PHP? Where PHP basically used? PHP is rapidly gaining popularity and numerous companies are switching their

find area uder the curve y=f(x) between x=a and x=b   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; in

In this lab, please complete a given program to perform the following tasks: 1. Allocate a 10 by 5 2D byte array dynamically. The way of allocation must be consistent with pag

Pls i only need help with program 2. #include #include using namespace std; int main() { int FilingStatus; cout cout cout cout cout cout

develop an algorithm using pseudocode for computing cos(x) and sin(x). use a sentinel controlled while loop. use the series definition of e^+-jx

Write a program to process bank accounts. Create a base class named Account and two derived classes named Savings and Checking. In the base class, use an int AccountNum and a dou

Study the given class specification and answer the questions that follow: class Person { private:   string name;   int yrBorn;   int yrDied;   public:   Per

decoding message

I need help with a c# program. Do yall help with c sharp