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
#an array that accept input and gives an output

Mixed Mode Expressions and Implicit type Conversions A mixed mode expression is one in which the operands are not of the similar type. In this case, the operands are converted

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome


The zipped folder int_collection.zip (downloaded from Blackboard) contains an abstract class AbstractIntCollection and two interfaces: IntList and IntStack. The abstract class cont

Write a C program to compute the factorial of  5 i.e 1x2x3x4x5 etc #include stdio.h   void main()   {   char promt;      int factor;   factor = 1*2*3*4*5;   printf("The fac

Within programs we very often want to execute a different section of code, depending upon various conditions within C the If statement is used to achieve this. The If statement con

Explain the different types of errors in PHP. Warnings, Notices and Fatal errors are the types of errors in PHP Notices: Notices signifies non-critical errors, i.e. ac

External Variables Different functions of the similar program can be written in different source files and can be compiled together. The scope of a global variable is not limit