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

Write a function to determine whether a number is prime: it will return true if the input is prime and false otherwise. Use it to see whether -7 is prime.

Normal 0 false false false EN-US X-NONE X-NONE

Described the difference among "new" and "operator new" ? A:"operator new" works such as malloc.

padovan string problem program 1 : package test.padovanstring; public class PadovanString {     public int stringOccurrences(int n, String str){        if(n >= 40)

We have used logic symbols in the past, but not really though about the actual real devices. Semiconductor companies have taken the logic symbols are manufactured them into logic f

M em b e r d e r e f e r e n c i ng o p e r a t o r s: T h e s e op e r a t o r s w i l l b e d i s c u s s e d l a t

What are the debugging methods you employ while came across a problem? A: Debugging with tools such as: 1.      DBG, GDB ,Forte, Visual Studio. 2.      Using tusc to trace

What are some guidelines / "rules of thumb" for overloading operators? A: Here are a few guidelines / rules of thumb .Use common sense. If your overloaded operator makes life si

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th