fork download
  1. #include <stdio.h>
  2. int main ( )
  3. {
  4.  
  5. int emp_num; /* number of employees */
  6. int clock_num; /* employee clock number */
  7. float gross_pay; /* gross pay for week (wage * hours) */
  8. float hours; /* number of hours worked per week */
  9. float wage; /* hourly wage */
  10. float overtime_hours;
  11. float overtime_pay; /* overtime pay */
  12. #define STD_HOURS 40.0
  13.  
  14. printf ("Enter number of employees to process:\n\n"); /* Prompt for user input */
  15. scanf ("%i", &emp_num); /* Reads user input */
  16.  
  17.  
  18. /* Prompt for input values from the screen */
  19.  
  20. for (emp_num = 1;emp_num <=5; ++emp_num) { /*Start of "for" Loop to run 5 times for each employee */
  21. printf ("Enter Employee's Clock #:\n");
  22. scanf ("%d", &clock_num);
  23. printf ("Enter hourly wage:\n");
  24. scanf ("%f", &wage);
  25. printf ("Enter number of hours worked::\n\n");
  26. scanf ("%f", &hours);
  27.  
  28. /* calculate gross pay */
  29. gross_pay = wage * hours;
  30. overtime_pay = 1.5 * wage;
  31. overtime_hours = hours - STD_HOURS;
  32.  
  33.  
  34.  
  35. if (hours > STD_HOURS)
  36. gross_pay = wage * hours + overtime_pay * overtime_hours;
  37.  
  38. /* print out employee information */
  39. printf ("\----------------------------------------------------------\n");
  40. printf ("\Clock# Wage Hours OT Gross\n");
  41. printf ("\----------------------------------------------------------\n");
  42. printf ("\%06i %5.2f %5.1f %.2f %7.2f\n\n",clock_num, wage, hours, overtime_pay, gross_pay); /* Data type formatting */
  43.  
  44. } /* END of loop */
  45.  
  46. return(0); /* success */
  47.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:39:13: warning: unknown escape sequence: '\-'
     printf ("\----------------------------------------------------------\n"); 
             ^
prog.c:40:13: warning: unknown escape sequence: '\C'
     printf ("\Clock# Wage Hours OT Gross\n"); 
             ^
prog.c:41:13: warning: unknown escape sequence: '\-'
     printf ("\----------------------------------------------------------\n"); 
             ^
prog.c:46:5: error: expected declaration or statement at end of input
     return(0); /* success */ 
     ^
stdout
Standard output is empty