fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5.  
  6. /*Decleration of variables that is need for this program.*/
  7. char menuOption;
  8. int employeeOption; //1 to employees list. 0 to quit.
  9. int employeeName;
  10. float employeeSales, employeeSalary;
  11. float fixedWage = 200;
  12. float employeeCommission = employeeSales \ 100 * 9;
  13.  
  14.  
  15.  
  16. printf ("\n\nPlease the number 1 to select an employee\n in order to calculate their wages for this week.\n");
  17. printf ("\n\n Select X to Quit.\n -->");
  18.  
  19.  
  20.  
  21.  
  22. /* While the end user does not select upper or lower case x.*/
  23. while (menuOption != 'X' || 'x'){
  24.  
  25. /*Prompt for the end user to make a selection of an employee or to start again.*/
  26. printf ("\n\nPlease Select an employee to check calculate wages for this week.\n\n");
  27.  
  28. printf("\n\n\tSelect 1 for:\t John.\n");
  29. printf("\tSelect 2:\t Chris.\n");
  30. printf("\tSelect 3:\t Bob.\n");
  31. printf("\tSelect 4:\t Tom.\n");
  32. printf("\tSelect 5:\t Alan.\n");
  33. printf("\tSelect 6:\t Steve.\n");
  34. printf("\tSelect 7:\t Harry.\n");
  35. printf("\tSelect 8:\t Tim.\n");
  36. printf("\tSelect 9:\t Grant.\n");
  37. printf("\tSelect 10:\t Jim.\n\n");
  38. printf("\tSelect 0 to Quit \n-->");
  39.  
  40.  
  41. if(scanf ("%d", &employeeOption) != 0){
  42. switch (employeeOption){
  43. case '1':
  44. printf("You have selected John\n");
  45. printf("Please enter Johns Sales for this week\n-->");
  46. scanf("%f", &employeeSales);
  47. employeeSalary = (fixedWage + employeeCommission);
  48. prinf("John has a total salary this week of: € %0.2d.\n", employeeSalary); //output
  49.  
  50. break;
  51. case '2':
  52. printf("You have selected Chris\n");
  53. printf("Please enter Johns Sales for this week\n-->");
  54. scanf("%0.2d", &employeeSales);
  55. employeeSalary = fixedWage + (employeeSales \100 * 9);
  56. prinf("Chris has a total salary this week of: € %0.2d.\n", employeeSalary);
  57.  
  58. break;
  59. case '3':
  60. printf("You have selected Bob\n");
  61. printf("Please enter Johns Sales for this week\n-->");
  62. scanf("%0.2d", &employeeSales);
  63. employeeSalary = fixedWage + (employeeSales \100 * 9);
  64. prinf("Bob has a total salary this week of: € %0.2d.\n", employeeSalary);
  65.  
  66. break;
  67. case '4':
  68. printf("You have selected Tom\n");
  69. printf("Please enter Johns Sales for this week\n-->");
  70. scanf("%0.2d", &employeeSales);
  71. employeeSalary = fixedWage + (employeeSales \100 * 9);
  72. prinf("Tom has a total salary this week of: € %0.2d.\n", employeeSalary);
  73.  
  74. break;
  75. case '5':
  76. printf("You have selected Alan\n");
  77. printf("Please enter Johns Sales for this week\n-->");
  78. scanf("%0.2d", &employeeSales);
  79. employeeSalary = fixedWage + (employeeSales \100 * 9);
  80. prinf("Alan has a total salary this week of: € %0.2d.\n", employeeSalary);
  81.  
  82. break;
  83. case '6':
  84. printf("You have selected Steve\n");
  85. printf("Please enter Johns Sales for this week\n-->");
  86. scanf("%0.2d", &employeeSales);
  87. employeeSalary = fixedWage + (employeeSales \100 * 9);
  88. prinf("Steve has a total salary this week of: € %0.2d.\n", employeeSalary);
  89.  
  90. break;
  91. case '7':
  92. printf("You have selected Harry\n");
  93. printf("Please enter Johns Sales for this week\n-->");
  94. scanf("%0.2d", &employeeSales);
  95. employeeSalary = fixedWage + (employeeSales \100 * 9);
  96. prinf("Harry has a total salary this week of: € %0.2d.\n", employeeSalary);
  97.  
  98. break;
  99. case '8':
  100. printf("You have selected Tim\n");
  101. printf("Please enter Johns Sales for this week\n-->");
  102. scanf("%0.2d", &employeeSales);
  103. employeeSalary = fixedWage + (employeeSales \100 * 9);
  104. prinf("Tim has a total salary this week of: € %0.2d.\n", employeeSalary));
  105.  
  106. break;
  107. case '9':
  108. printf("You have selected Grant\n");
  109. printf("Please enter Johns Sales for this week\n-->");
  110. scanf("%0.2d", &employeeSales);
  111. employeeSalary = fixedWage + (employeeSales \100 * 9);
  112. prinf("Grant has a total salary this week of: € %0.2d.\n", employeeSalary);
  113.  
  114. break;
  115. case '10':
  116. printf("You have selected Jim\n");
  117. printf("Please enter Johns Sales for this week\n-->");
  118. scanf("%0.2d", &employeeSales);
  119. employeeSalary = fixedWage + (employeeSales \100 * 9);
  120. prinf("Jim has a total salary this week of: € %0.2d.\n",employeeSalary);
  121.  
  122. break;
  123. case '0':
  124. printf("!!You have selected to go back to the main menu.\n");
  125. Quit(); //dont know what to put here
  126. break;
  127. }
  128. }
  129.  
  130. return 0;
  131.  
  132. }
  133.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:12:2: error: stray '\' in program
  float employeeCommission = employeeSales \ 100 * 9;
  ^
prog.c:12:45: error: expected ',' or ';' before numeric constant
  float employeeCommission = employeeSales \ 100 * 9;
                                             ^
prog.c:48:6: warning: implicit declaration of function 'prinf' [-Wimplicit-function-declaration]
      prinf("John has a total salary this week of: € %0.2d.\n", employeeSalary);       //output
      ^
prog.c:54:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:54:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:54:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:55:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:55:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:62:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:62:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:62:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:63:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:63:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:70:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:70:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:70:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:71:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:71:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:78:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:78:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:78:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:79:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:79:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:86:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:86:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:86:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:87:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:87:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:94:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:94:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:94:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:95:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:95:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:102:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:102:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:102:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:103:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:103:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:104:80: error: expected ';' before ')' token
      prinf("Tim has a total salary this week of: € %0.2d.\n", employeeSalary));
                                                                                ^
prog.c:104:80: error: expected statement before ')' token
prog.c:110:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:110:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:110:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:111:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:111:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:115:10: warning: multi-character character constant [-Wmultichar]
     case '10':
          ^
prog.c:118:12: warning: zero width in gnu_scanf format [-Wformat=]
      scanf("%0.2d", &employeeSales);
            ^
prog.c:118:12: warning: unknown conversion type character '.' in format [-Wformat=]
prog.c:118:12: warning: too many arguments for format [-Wformat-extra-args]
prog.c:119:6: error: stray '\' in program
      employeeSalary = fixedWage + (employeeSales \100 * 9);
      ^
prog.c:119:51: error: expected ')' before numeric constant
      employeeSalary = fixedWage + (employeeSales \100 * 9);
                                                   ^
prog.c:125:6: warning: implicit declaration of function 'Quit' [-Wimplicit-function-declaration]
      Quit();        //dont know what to put here
      ^
prog.c:132:1: error: expected declaration or statement at end of input
 }
 ^
prog.c:9:6: warning: unused variable 'employeeName' [-Wunused-variable]
  int employeeName;
      ^
stdout
Standard output is empty