一个简单的C程序Neen帮助 [英] Neen help for a simple c program
本文介绍了一个简单的C程序Neen帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个简单的C程序需要帮助。编写一个程序TestValue。该程序运行,但不会返回一个字母等级。
这是我到目前为止所。
的#include<&stdio.h中GT;
诠释的main()
{
双testValue;
焦炭getGrade;
的printf(请输入你的分数O和100之间:);
scanf函数(%如果,&安培; testValue);
的printf(你的品位%C \\ N,getGrade);
返回1;
}
焦炭getGrade(双值)
{
如果(价值> = 90)
return'A';
否则,如果(价值> = 80)
return'B';
否则,如果(价值> = 70)
return'C';
否则,如果(价值> = 60)
return'D';
否则,如果(价值> = 50)
return'F';
返回1;
}
解决方案
%,如果
应%LF
您已经不叫 getGrade
函数
您有两个标识符名称相同。
删除字符getGrade;
声明并调用 getGrade
函数
Need help on a simple c program. Writing a TestValue program. The program runs but doesn't return a letter grade. This is what I have so far.
#include <stdio.h>
int main()
{
double testValue;
char getGrade;
printf("Enter your score between o and 100:");
scanf("%if", &testValue);
printf("Your grade is %c\n", getGrade);
return 1;
}
char getGrade(double value)
{
if(value>=90)
return'A';
else if(value>=80)
return'B';
else if(value>=70)
return'C';
else if(value>=60)
return'D';
else if(value>=50)
return'F';
return 1;
}
解决方案
%if
Should be %lf
You have not called the getGrade
function
You have two identifiers with the same name.
Remove the char getGrade;
declaration and just call the getGrade
function.
这篇关于一个简单的C程序Neen帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文