user-0 提问: 如何评价这些代码？（来自一位初学加自学者，就是我了h'h'h）

回复:
user: user-1
content: 具体内容没可看，看了下数量及运用了比较多的循环、条件等结构之类。 初学者的话，如果代码能跑起来，且运行效果观感上没有什么毛病的话。可以给个70~80。

user: user-2
content: #include<stdio.h>  #define H_WAGE1 8.75 #define H_WAGE2 9.33 #define H_WAGE3 10.00 #define H_WAGE4 11.20 #define TIME1 30 #define TIME2 40 #define RATE_T 1.5 #define RATE1 0.15 #define RATE2 0.2 #define RATE3 0.25 #define BREAK1 300 #define BREAK2 450  int main(void) {     float time,total,tax,net,H_WAGE;     int choice;      printf("*****************************************************************\n");     printf("Enter the number corresponding to the desired pay rate or action:\n") ;     printf("(1)$8.75/hr                          (2)$9.33/hr\n");     printf("(3)$10.00/hr                         (4)$11.20/hr\n");     printf("(5)quit\n");     printf("*****************************************************************\n");      while (1) {         printf("Enter the choice:\n");         scanf("%d",&choice);         //if(choice==1||choice==2||choice==3||choice==4||choice==5)         //{         switch(choice)         {             case 1:                 H_WAGE=H_WAGE1;                 printf("Your choice is 1,$8.75/hr.\n");                 break;             case 2:                 H_WAGE=H_WAGE2;                 printf("Your choice is 2,$9.33/hr.\n");                 break;             case 3:                 H_WAGE=H_WAGE3;                 printf("Your choice is 3,$10.00/hr.\n");                 break;             case 4:                 printf("Your choice is 4,$11.20/hr.\n");                 H_WAGE=H_WAGE4;                 break;             case 5:                 printf("Your choice is 5,to quit.\n");                 H_WAGE=0;                 break;              default:                 printf("Enter the right number.\n");                 break;         }         if (choice <= 5 && choice >= 1)             break;     }     //else     //   printf("Enter the right number.\n");     while(H_WAGE!=0)     {         printf("Please enter the working time per week:\n");          while(scanf("%f",&time)==1)         {              if(time>=0)             {                 if(time<=TIME1)                 {                     total=time*H_WAGE;                     tax=total*RATE1;                 }                 else if(time<TIME2)                 {                     total=time*H_WAGE;                     tax=TIME1*H_WAGE*RATE1+(time-TIME1)*H_WAGE*RATE2;                 }                 else                 {                     time=TIME2+(time-TIME2)*RATE_T;                     total=time*H_WAGE;                     if(total<BREAK2)                         tax=TIME1*H_WAGE*RATE1+(time-TIME1)*H_WAGE*RATE2;                     else                         tax=TIME1*H_WAGE*RATE1+(BREAK2-BREAK1)*RATE2+(total-BREAK2)*RATE3;                 }                 net=total-tax;                 printf("Time is %.2f hours,total income is %.2f,tax is %.2f,net income is %.2f\n"                         ,time,total,tax,net);              }             else                 printf("Time cannot be negtive.\n") ;             printf("Enter time again or q to quit.\n");             H_WAGE=0;         }     }     printf("Done!\n");      return 0; } 上面的回复有误，用这个吧～

user: user-2
content: #include<stdio.h>  #define H_WAGE1 8.75 #define H_WAGE2 9.33 #define H_WAGE3 10.00 #define H_WAGE4 11.20 #define TIME1 30 #define TIME2 40 #define RATE_T 1.5 #define RATE1 0.15 #define RATE2 0.2 #define RATE3 0.25 #define BREAK1 300 #define BREAK2 450  int main(void) {     float time,total,tax,net,H_WAGE;     int choice;      printf("*****************************************************************\n");     printf("Enter the number corresponding to the desired pay rate or action:\n") ;     printf("(1)$8.75/hr                          (2)$9.33/hr\n");     printf("(3)$10.00/hr                         (4)$11.20/hr\n");     printf("(5)quit\n");     printf("*****************************************************************\n");      while (1) {         printf("Enter the choice:\n");         scanf("%d",&choice);         //if(choice==1||choice==2||choice==3||choice==4||choice==5)         //{         switch(choice)         {             case 1:                 H_WAGE=H_WAGE1;                 printf("Your choice is 1,$8.75/hr.\n");                 break;             case 2:                 H_WAGE=H_WAGE2;                 printf("Your choice is 2,$9.33/hr.\n");                 break;             case 3:                 H_WAGE=H_WAGE3;                 printf("Your choice is 3,$10.00/hr.\n");                 break;             case 4:                 printf("Your choice is 4,$11.20/hr.\n");                 H_WAGE=H_WAGE4;                 break;             case 5:                 printf("Your choice is 5,to quit.\n");                 H_WAGE=0;                 break;              default:                 printf("Enter the right number.\n");                 break;         }         if (choice <= 5 && choice >= 1)             break;     }     //else     //   printf("Enter the right number.\n");     //while(H_WAGE!=0)    //H_WAGE初始化了吗？没初始化不能用     while(1)    //H_WAGE初始化了吗？没初始化不能用     {         printf("Please enter the working time per week:\n");          while(scanf("%f",&time)==1)         {              if(time>=0)             {                 if(time<=TIME1)                 {                     total=time*H_WAGE;                     tax=total*RATE1;                 }                 else if(time<TIME2)                 {                     total=time*H_WAGE;                     tax=TIME1*H_WAGE*RATE1+(time-TIME1)*H_WAGE*RATE2;                 }                 else                 {                     time=TIME2+(time-TIME2)*RATE_T;                     total=time*H_WAGE;                     if(total<BREAK2)                         tax=TIME1*H_WAGE*RATE1+(time-TIME1)*H_WAGE*RATE2;                     else                         tax=TIME1*H_WAGE*RATE1+(BREAK2-BREAK1)*RATE2+(total-BREAK2)*RATE3;                 }                 net=total-tax;                 printf("Time is %.2f hours,total income is %.2f,tax is %.2f,net income is %.2f\n"                         ,time,total,tax,net);              }             else                 printf("Time cannot be negtive.\n") ;             printf("Enter time again or q to quit.\n");             H_WAGE=0;         }         if (H_WAGE == 0)             break;     }     printf("Done!\n");      return 0; } 供参考～

user: user-3
content: 初学者要学的第一件事是 代码缩进写好 处理好这件事之前 不用讨论怎么评价代码 不入流

user: user-4
content: 第一个if...else语句完全是多余的，switch语句就行了。

user: user-0
content: 引用 1 楼 user-4 的回复:第一个if...else语句完全是多余的，switch语句就行了。多谢指教，我再修改一下

user: user-0
content: 多谢指教 ，以后多注意