需要一個簡單的c程序的幫助。編寫一個TestValue程序。程序運行但不返回字母等級。 這是我到目前爲止。一個簡單的c程序的幫助
#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;
}
'main'函數在終止時沒有錯誤應該返回'0',否則就是不等於'0'。在你的例子中,你基本上告訴操作系統你的程序因錯誤而終止。 – Pablo
詢問相同的[問題](http://stackoverflow.com/questions/12832382/simple-correction-for-ac-program) –