fork download
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. class Employee
  6. {
  7. public:
  8. Employee(int empID, int pay);
  9. Employee(int empID);
  10. Employee();
  11.  
  12. void input();
  13. void output();
  14. int getSalary();
  15. int getempID();
  16. private:
  17. int empId;
  18. int pay;
  19. };
  20.  
  21. int main()
  22. {
  23. Employee myEmployee(2, 21), yourEmployee(5), ourEmployee;
  24. cout<<"Worker Information:\n";
  25. myEmployee.output();cout<<endl;
  26. yourEmployee.output();cout<<endl;
  27. ourEmployee.output();cout<<endl;
  28.  
  29. myEmployee = Employee(10,31);
  30. cout << "myEmployee is changed to the following values: \n";
  31. myEmployee.output();cout<<endl;
  32.  
  33. system("pause");
  34.  
  35. return 0;
  36. }
  37. Employee::Employee(int EmpID, int Pay):empID(EmpID), pay(Pay)
  38. {
  39. cout<<"the new worker has been created!!"<<endl;
  40. }
  41.  
  42. Employee::Employee(int EmpID): pay(1)
  43. {
  44. cout<<"the new worker has been created!!!"<<endl;;
  45. }
  46. Employee::Employee():empId(1),pay(1)
  47. {
  48.  
  49. cout<<"the new worker has been created!!!!"<<endl;
  50. }
  51. void Employee::output()
  52. {
  53. input();
  54. cout<<"the employee ID number is: "<<empID<<" And their salary is: "<<pay<<endl;
  55. }
  56. int Employee::getSalary()
  57. {
  58. return pay;
  59. }
  60. int Employee::getID()
  61. {
  62. return empID;
  63. }
  64. void Employee::input()
  65. {
  66. cout<<"Please enter the value for the workers's employee ID"<<endl;
  67. cin>>empID;
  68. cout<<"And enter the value for the worker's pay: "<<endl;
  69. cin>>pay;
  70. }
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.
stdout
Standard output is empty