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
array itself is a pinter.explain

Encapsulation and Data Hiding The property of being a self-contained unit is known as encapsulation. The idea that the encapsulated unit can be used without knowing how it work


A: The procedure of encoding the parameter types along with the function/method name into a unique name is called as name mangling. The inverse procedure is called demangling. F

Flash my terminal vx670 Project Description: Have VeriFone software need it to communicate with the vx670 through com port 1 it is not talking I'm not sure why have all the r

Please give me a programming code of first & follow with c or c++ laqnguage .When anyone give me the programming code of first & follow please explain every lines with the help


please answer the question of following Write a function that calculates the number of elapsed days between two dates. For example the days between Feb 3, 1970 and June 21, 1980? B

Programming an odds betting website Project Description: We want someone to program a odds betting website, Require someone with experience and skills! Skills required are

Explain procedural logic A procedure, or function, was explained as a set of specific instructions implemented in sequential manner. The data is kept separate from the procedur