fork(1) download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: Timothy Niesen
  6. //
  7. // Class: C Programming, Fall 2022
  8. //
  9. // Date: 9/19/22
  10. //
  11. // Description: Program which determines gross pay and outputs
  12. // be sent to a designated file. This version does not use file pointers
  13. //
  14. //
  15. //********************************************************
  16.  
  17. #include <stdio.h>
  18. int main()
  19. {
  20. int clockNum;
  21. float grossPay;
  22. float hoursWorked;
  23. float hourlyWage;
  24. printf ("This is a program to calculate gross pay.\n");
  25. printf ("You will be prompted for employee data.\n\n");
  26. printf ("Enter clock number for employee: ");
  27. scanf ("%d", &clockNum);
  28. printf ("Enter hourly wage for employee: ");
  29. scanf ("%f", &hourlyWage);
  30. printf ("Enter the number of hours the employee worked: ");
  31. scanf ("%f", &hoursWorked);
  32.  
  33. grossPay = hourlyWage * hoursWorked;
  34.  
  35. printf ("\n\t\tC Programming, First Homework Assignment\n\n\n");
  36. printf ("\t----------------------------------------------------------\n");
  37. printf ("\tClock # Wage Hours Gross\n");
  38. printf ("\t----------------------------------------------------------\n");
  39.  
  40. printf ("\t%06i %5.2f %5.1f %7.2f\n",
  41. clockNum, hourlyWage, hoursWorked, grossPay);
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 5388KB
stdin
Standard input is empty
stdout
This is a program to calculate gross pay.
You will be prompted for employee data.

Enter clock number for employee: Enter hourly wage for employee: Enter the number of hours the employee worked: 
		C Programming, First Homework Assignment


	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	021900  0.00   0.0    0.00