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

Assignment Help:

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


Related Discussions:- C program to create, update & display account & admin

Explain logical operators, Logical Operators We say any expression that...

Logical Operators We say any expression that evaluates to zero is a FALSE logic condition and that evaluating to non-zero value is a TRUE condition. Logical operators are usefu

Luminous Jewels - The Polishing Game, First line starts with T, number of t...

First line starts with T, number of test cases. Each test case T contains a necklace (N).

Flowcharting., flowcharting of 3 quizes display the average

flowcharting of 3 quizes display the average

Area under curve., write a c progrm to find area under the cuve y=f(x)  ...

write a c progrm to find area under the cuve y=f(x)   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; in

Functions, program that convert take decimal digit and convert it to binart...

program that convert take decimal digit and convert it to binart digit

Define bit fields, Define Bit Fields Bit Fields permits the packing of ...

Define Bit Fields Bit Fields permits the packing of data in a structure. This is particularly useful when memory or data storage is at a premium. Usual examples: Packing

Minimum shelves, write a program to find the minimum number of shelves

write a program to find the minimum number of shelves

Minimum Shelf , At a shop of marbles, packs of marbles are prepared. Packet...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers

Functions, differentiate between inbuilt and user defined functions

differentiate between inbuilt and user defined functions

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd