C++


SUBMITTED BY: Hemraj4545

DATE: May 27, 2017, 4:15 p.m.

FORMAT: Text only

SIZE: 734 Bytes

HITS: 452

  1. #include<iostream.h>
  2. void main( )
  3. {
  4. char name[20],subject[20];
  5. float Basic,HRA,DA,Salary;
  6. float calculate( )
  7. {
  8. return(Basic+DA+HRA);
  9. }
  10. public:
  11. void Readdata( )
  12. {
  13. cout<<"Enter the name of Teacher:";
  14. gets(name);
  15. cout<<"Enter the subject:";
  16. gets(subject);
  17. cout<<"Enter Basic:";
  18. cin>>Basic;
  19. cout<<"Enter HRA:";
  20. cin>>HRA;
  21. cout<<"Enter DA:";
  22. cin>>DA;
  23. salary=calculate( );
  24. }
  25. void Displaydata( )
  26. {
  27. cout<<"Details of Teacher:"<<endl;
  28. cout<<"-------------------"<<endl;
  29. cout<<"Name:"<<name<<endl;
  30. cout<<"Subject:"<<subject<<endl;
  31. cout<<"Basic:"<<Basic<<endl;
  32. cout<<"DA:"<<DA<<endl;
  33. cout<<"HRA:"<<HRA<<endl;
  34. cout<<"Salary:"<<salary<<endl;
  35. }
  36. };
  37. void main( )
  38. {
  39. TEACHER T;
  40. T.Readdata( );
  41. T.Displaydata( );
  42. }

comments powered by Disqus