* Branch-11. Calculate the salary

Source: Internet
Author: User

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...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.