Program is to define a class as teacher, C/C++ Programming

Program is to define a class as teacher:

Program is to define a class as teacher and collect information about them by using classes and object

class teacher

  {

  private:

    char name[20];

    char sub[10];

    float basic,hra,da;

    float salary;

    int calculate()

     {

     salary=basic+hra+da;

      return salary;

     }

  public:

     void readdata();

     void dispdata();

  };

 

void teacher::readdata()

  {

  clrscr();

  cout<<" enter your name "<<"\n";

  gets(name);

  cout<<" enter the subject you teach "<<"\n";

  cin>>sub;

  cout<<" enter the basic salary "<<"\n";

  cin>>basic;

  cout<<" enter the house rent allowance "<<"\n";

  cin>>hra;

  cout<<" enter the dearance allowance"<<"\n";

  cin>>da;

   }

 

void teacher::dispdata()

  {

  clrscr();

  cout<<" the name is :"<

  cout<<" the subject you teach is :"<

  calculate();

  cout<<" the salary you get is : "<

  }

 

 void main()

  {

  clrscr();

  teacher info;

  info.readdata();

  info.dispdata();

  }

Posted Date: 10/19/2012 5:32:27 AM | Location : United States







Related Discussions:- Program is to define a class as teacher, Assignment Help, Ask Question on Program is to define a class as teacher, Get Answer, Expert's Help, Program is to define a class as teacher Discussions

Write discussion on Program is to define a class as teacher
Your posts are moderated
Related Questions
Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers

#questiStarting with a blank solution, write a program to prompt the user for an employee number, hourly rate and hours worked. Compute and display the employee number, gross weekl

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

I need a project on car rental system using c programming only of college level

Described multiple inheritance(virtual inheritance)? And explain its advantages and disadvantages? A: It is the procedure in which a child can be derived from more than one pare

# include stdio.h> # include string.h> # include conio.h> void main() {           int i=0,j=0,b=0,count=0;           int a[100];           for(i=0;i

#questi An array of n numbers is given, where n is an even number. The maximum as well as minimum of these given numbers need to be determined. Which of the following is true about

Help me evaluate suitable OpenCV filters to get an inital working tracking algorithm. In this case it's objects moving on water (sea) and since I have very limited OpenCV knowledge

#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 of packets with the

I need to program a microprocessor that would have a temperature, gas, humidity and PIR sensor connected to it. It would send the data to a PC via a Zigbee and receive commands fro