1/* 2 * Main. c 3 * B11-branch-11. calculated salary (15) 4 * Created on: June 3, 2014 5 * Author: boomkeeper 6*7 * failed to pass the test * 8 */9 10 # include <stdio. h> 11 # include <stdlib. h> 12 13 float salary = 0; 14 15 void newStaff (int * worktime) 16 {17 // printf ("Run newStaff () \ n") now "); 18 if (* worktime <= 40) 19 {20 // printf ("START computing now <= 40 \ n"); 21 salary = (* worktime) * 30; 22 printf ("%. 2f \ n ", salary); 23} 24 else25 {26 // printf (" START computing now> 40 \ n "); 27 salary = (* worktime-40) * 30*1.5 + 40*30; 28 printf ("%. 2f \ n ", salary); 29} 30} 31 32 void oldStaff (int * worktime) 33 {34 // printf (" start executing oldStaff () \ n "); 35 if (* worktime <= 40) 36 {37 // printf ("START computing now <= 40 \ n"); 38 salary = (* worktime) * 50; 39 printf ("%. 2f \ n ", salary); 40} 41 else42 {43 // printf (" START computing now> 40 \ n "); 44 salary = (* worktime-40) * 30*1.5 + 40*50; 45 printf ("%. 2f \ n ", salary); 46} 47} 48 49 int main () 50 {51 int workTime = 0, workYear = 0; 52 int * worktime = & workTime, * workyear = & workYear; 53 54 scanf ("% I", workyear, worktime); 55 56 if (* worktime <0 | * workyear <0) // data smaller than 0 is abnormal 57 exit (0); 58 if (* worktime >=( 7*24 )) // abnormal 59 exit (0); 60 61 if (* workyear <5) 62 newStaff (worktime); 63 else64 oldStaff (worktime ); 65 66 return 0; 67}
The following questions were all depressing and were not completely passed. Some of the results returned by the test points were incorrect, which is the cause of the examination, but I have carefully read the questions several times...