fork download
  1. #include<iostream.h>
  2. #include <vector>
  3. #include <stdio.h> //ahmed.h
  4. #include<conio.h>
  5.  
  6.  
  7.  
  8. struct employee
  9. {
  10. char name[20];
  11. float salary;
  12. int birthday;
  13. char sex [10];
  14.  
  15. };
  16. void main()
  17. {
  18.  
  19. employee emp[100];
  20.  
  21. {
  22. int n;
  23.  
  24. cout << "A program for collecting employee information";
  25. cout << endl;
  26. cout << "And displaying the collected information";
  27. cout << endl << endl;
  28. cout << "How many employees:";
  29. cin >> n;
  30. cout << endl;
  31.  
  32.  
  33. cout << "Enter the following information:"<<endl;
  34. cout << endl;
  35.  
  36. for (int i=0; i<n; i++){
  37. cout << "Enter information for employee no: " << i;
  38. cout << endl;
  39.  
  40.  
  41. cout<<"Enter the Employee name :" ;cin>>emp[i].name;
  42. cout<<"Enter the salary :";cin>>emp[i].salary;
  43. cout<<"Enter the birthday :";cin>>emp[i].birthday ;
  44. cout<<"Enter the sex :";cin>>emp[i].sex;
  45. cout<<endl;
  46. }
  47.  
  48.  
  49. void bubb(employee emp,int n); //bubble sort
  50. {
  51. employee temp;
  52. for(int j=0;j<n;j++)
  53. {
  54. if(emp[j].salary<emp[j+1].salary)
  55. {
  56. for(int i=j;i<n-1;i++)
  57. {
  58. temp=emp[i];
  59. emp[i]=emp[i+1];
  60. emp[i+1]=temp;
  61. }
  62. }
  63. }
  64.  
  65.  
  66. cout << "Employee entered information:"<< endl;
  67. cout << "============================" << endl;
  68. cout << "Name salary birthday Sex " << endl;
  69. for( i=0;i<n;i++)
  70. {
  71. cout << emp[i].name << "\t";
  72. cout << emp[i].salary << "\t";
  73. cout << emp[i].birthday; cout << "\t";
  74. cout << emp[i].sex ;
  75. cout << endl;
  76.  
  77. }
  78.  
  79.  
  80. int highest_salary=0;
  81. int total_salary=0;
  82. for ( i = 0; i < n; i++) {
  83. if (emp[i].salary > highest_salary)
  84. highest_salary = emp[i].salary;
  85.  
  86. total_salary += emp[i].salary;
  87. }
  88. cout<<endl;
  89. cout << "Total Salary: " << total_salary <<endl;
  90. cout << "============"<<endl;
  91. cout << "Highest Salary: " << highest_salary << endl;
  92. cout << "=============="<<endl;
  93.  
  94.  
  95.  
  96. void main(); //calc tax
  97.  
  98. float tax=0;
  99. float salary=0;
  100.  
  101. if (emp[i].salary<=1999)
  102. {
  103. tax=(emp[i].salary*5)/100;
  104. }
  105.  
  106. else if (emp[i].salary<=2999)
  107. {
  108. tax=(emp[i].salary*7.5)/100;
  109.  
  110. }
  111.  
  112. else if (emp[i].salary<=3999)
  113. {
  114. tax=(emp[i].salary*10)/100;
  115. }
  116.  
  117.  
  118. else if (emp[i].salary>4000)
  119. {
  120.  
  121. tax=(emp[i].salary*15)/100;
  122. }
  123.  
  124.  
  125. salary=emp[i].salary-tax;
  126.  
  127.  
  128.  
  129. cout<<"Salary after tax :"<<" Employee Name : "<<endl;
  130. cout<<"================ " <<" ============="<<endl;
  131. for( i=0;i<n;i++)
  132. cout<< salary<<" " << emp[i].name<<endl;
  133. }
  134.  
  135. }
  136. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: fatal error: iostream.h: No such file or directory
compilation terminated.
stdout
Standard output is empty