您的位置首页百科问答

C语言中switch case语句的问题

C语言中switch case语句的问题

# include void main(){int I, k, a, b, c, d, e, f,g;printf("请输入冲改利润I:\n");scanf("%d", &I);a = I * (1.0f/10); //此处强制为浮租棚点类型,不然a一直是0,看你的意思了b = (I - 100000) * 75/1000;c = (I - 200000) * 5/100;d = (I - 400000) * 3/100;e = (I - 600000) * 15/1000;f = (I - 1000000) * 1/100;g = (I - 1) / 100000;switch(g){ case 0: printf("奖金总数k=%d\n", a); break; case 1: printf("奖金总数k=%d\n", a + b); break; case 2: case 3: printf("奖金总数k=%d\n", a + b + c); break; case 4: case 5: printf("奖金总数k=%d\n"散型判, a + b + c + d); break; case 6: case 7: case 8: case 9: printf("奖金总数k=%d\n", a + b + c + d + e); break; default : printf("奖金总数k=%d\n", a + b + c + d + e + f); break;}望采纳~