fork download
  1. //12 no
  2. #include<bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. class Employee
  7. {
  8. public:
  9. int salary,work;
  10.  
  11. void getInfo(int s, int wh)
  12. {
  13. salary=s;
  14. work=wh;
  15. }
  16.  
  17. void AddSal()
  18. {
  19. if(salary<500){
  20. salary+=10;
  21. }
  22. }
  23.  
  24. void Addwork()
  25. {
  26. if(work>6){
  27. salary+=5;
  28. }
  29. }
  30.  
  31. void display(){
  32. cout<<"Total Salary: "<<salary<<endl;
  33. }
  34.  
  35.  
  36. };
  37.  
  38. int main()
  39. {
  40. Employee emp;
  41. int salary,hours;
  42.  
  43. cout<<"Input Salary: ";
  44. cin>>salary;
  45. cout<<"Input Hours: ";
  46. cin>>hours;
  47.  
  48. emp.getInfo(salary,hours);
  49. emp.AddSal();
  50. emp.Addwork();
  51. emp.display();
  52.  
  53. return 0;
  54. }
  55.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Input Salary: Input Hours: Total Salary: 1400545381