该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
printf("the aver of bonus is %d\n", aver_b );
/* 按基本工资和奖金的多少输出各段的个数*/
for (i=0;i
{
if (w[i].wage>3001 ) a+=1;
if (w[i].wage<3000&&w[i].wage>2001) b+=1;
if (w[i].wage<2000&&w[i].wage>1501) c+=1;
if (w[i].wage<1500&&w[i].wage>1001) d+=1;
if (w[i].wage<1000) e+=1;
if (w[i].bonus>301 ) f+=1;
if (w[i].bonus<300&&w[i].bonus>201 ) g+=1;
if (w[i].bonus<200&&w[i].bonus>151 ) h+=1;
if (w[i].bonus<150&&w[i].bonus>100 ) j+=1;
if (w[i].bonus<100) k+=1;
}
printf("The number of presons that whose wage >3001 is %d\n",a );
printf("The number of presons that whose wage <3000 || >2001 is %d\n",b);
printf("The number of presons that whose wage <2000 || 1501> is %d\n",c);
printf("The number of presons that whose wage <1500 || 1001> is %d\n",d);
printf("The number of presons that whose wage <1000 is %d\n",e);
printf("The number of presons that whose bonus>301 is %d\n",f );
printf("The number of presons that whose bonus<300 || >201 is %d\n",g );
printf("The number of presons that whose bonus<200 || >151 is %d\n",h );
printf("The number of presons that whose bonus<150 || >101 is %d\n",j);
printf("The number of presons that whose bonus<100 is %d\n",k);
/* 输出工资低于1000或奖金低于100的职工姓名*/
for (i=0;i<10;i++)
{
if(w[i].wage<1000&&w[i].bonus<100)
printf("%d%c",w[i].num,w[i].name);
}
getch();
}
这样运行没问题,但由于我想把结构体中num的数据类型由int型改为float型,于是在那三段代码对应的这三个地方分别
把第7行的“long int”改为“float”;
把第21行的第一个“ld”改为“f”;
把第51行的“ld”改为“f”。
然后问题就出来了:点击“编译链接并运行”按键后,窗口跳出一下后立刻消失!真不明白“数据类型”跟“运行窗口”有什么关系!
其实并不单单在这个程序里,我发现在很多很小的程序里也是这个情况,只要把“long int”改为“float”;把“d”改为“f”,结果就是:窗口弹出立马消失。
C语言高手进来解释下……