#include "stdafx.h"
#include "stdio.h"
int main(int argc, char* argv[])
{ float score;
printf("请输入学生成绩:/n");
scanf("%f/n",&score);//为什么要进行两次输入,判断的是输入的第一个数据? (换行符的问题)
if(score>=60.00) printf("PASS!/n");
if(score<60.00) printf("FAIL!/n");
return 0;
}
如下例程比较规范 #include "stdafx.h"
int main(int argc, char* argv[]) { float score; printf("Please scanf the student's Score:/n"); scanf("%f",&score); if(score<60)//两个IF语句或用IF...ELSE结构。 printf("The score is Fail./n"); if(score>=60) printf("The score is Pass./n"); return 0; }
//成绩在60分及以上的打印为“PASS”,否则“FAIL”.