int main(void)
{
float score;
printf("请输入你的考试成绩:\n");
scanf("%f", score);
if(score > 100)
printf("白日做梦\n");
else if(score>=90 && score<=100)
printf("优\n");
else if(score>=80 && score printf("良\n");
else if(score>=60 && score printf("及格\n");
else if(score>=0 && score<60)
printf("不及格\n");
else
printf("太差了\n");
return 0;
}
else if(score>=80 && score printf("良\n");
else if(score>=60 && score printf("及格\n");
这是什么意思?
最后那个【太差了的输出】就没有意义啊,上面已经把0-100这个分数段输完了,总不会有输入负数吧?另外你的代码有很多的错误,刚开始就错了,让人感觉不知道你是用啥写的!我猜你是想用C写吧?
最后那个【太差了的输出】就没有意义啊,上面已经把0-100这个分数段输完了,总不会有输入负数吧?另外你的代码有很多的错误,刚开始就错了,让人感觉不知道你是用啥写的!我猜你是想用C写吧?你可以参考一下下面的代码!
#include
int main()
{
float score;
printf("请输入您的考试成绩:\n");
scanf("%f",&score);
if(score>100)
printf("白日做梦!\n");
else if(score>=90&&score<=100)
printf("优!\n");
else if(score>=80&&score printf("良!\n");
else if(score>=60&&score<80)
printf("及格\n");
else
printf("不及格!\n");
return 0;
}
/*int main(void)
{
float score;
printf("请输入你的考试成绩:\n");
scanf("%f", score);
if(score > 100)
printf("白日做梦\n");
else if(score>=90 && score<=100)
printf("优\n");
else if(score>=80 && score printf("良\n");
else if(score>=60 && score printf("及格\n");
else if(score>=0 && score<60)
printf("不及格\n");
else
printf("太差了\n");
return 0;
}*/
scanf("%f", score);
if(score > 100)
加粗的地方少了&