| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
#include <stdio.h> 
int main() 
{ 
        float x, sum, a = 0, b = 0, c; 
        printf("学生成绩:"); 
        while (x!= -1); 
        { 
                a = a + 1; 
                if (x<60) 
                        b = b + 1; 
                printf("学生成绩:"); 
                scant("%f", &x); } 
 
        c = b / a; 
        printf("\n应付金额=%f\n", c); 
        return 0; 
        } 
 
 
 
严重性        代码        说明        项目        文件        行        禁止显示状态 
警告        C6001        使用未初始化的内存“x”。        hello        D:\vs2019\vs2019\hello\1.c        7         
严重性        代码        说明        项目        文件        行        禁止显示状态 
警告        C4013        “scant”未定义;假设外部返回 int        hello        D:\vs2019\vs2019\hello\1.c        13         
严重性        代码        说明        项目        文件        行        禁止显示状态 
警告        C4101        “sum”: 未引用的局部变量        hello        D:\vs2019\vs2019\hello\1.c        5         
严重性        代码        说明        项目        文件        行        禁止显示状态 
错误        C4700        使用了未初始化的局部变量“x”        hello        D:\vs2019\vs2019\hello\1.c        7         
 
 
感谢大神
- #include <stdio.h>
 
 - int main()
 
 - {
 
 -         //sum没有用到,可以去掉
 
 -         float x, sum, a = 0, b = 0, c;
 
 -         printf("学生成绩:");
 
 -         //x使用前要初始化
 
 -         x=0;
 
 -         while (x!= -1)
 
 -         {
 
 -                 //输入要放在最前面
 
 -                 //是scanf ,不是scant
 
 -                 scanf("%f", &x); 
 
 -                 a = a + 1;
 
 -                 if (x<60)
 
 -                         b = b + 1;
 
 -                 printf("学生成绩:");
 
 -                 
 
 -         
 
 -                 c = b / a;
 
 -                 printf("\n应付金额=%f\n", c);
 
 -         }
 
 -         return 0;
 
 - } 
 
  复制代码 
 
 
 |   
 
 
 
 |