#include
#include
int main()
{
int grade;
printf("The student's grade(if you print 1000 , break!!):");
scanf("%f", &grade);
if(grade >= 90)
printf("This student gets A , very good");
if(grade < 90 && grade >= 80)
printf("This student gets B , so so");
if(grade < 80 && grade >= 70)
printf("This student gets C");
if(grade < 70 && grade >= 60)
printf("This student gets D");
if(grade < 60)
printf("This student gets F");
else if(grade == 1000)
break;
system("pause");
return 0;
}
正如你所看到的...這支程式...為什麼不能跑??
錯在哪??
(我是c語言小菜鳥><")
會出現怪怪的符號。。。請見諒><"
2007-03-12 19:50:50 · 2 個解答 · 發問者 一粒蛋≧﹏≦ 2 in 電腦與網際網路 ➔ 程式設計
//Power by Visual Studio 2005
#include
#include
#include
#ifndef _MAX_ENV
#define _MAX_ENV 32767
#endif
int main(int argc, char* argv[]){
//==========START==========//
double dGRADE;//數值
char LETTER[_MAX_ENV];//字串陣列
do{
printf("Input grade: ");
scanf("%lf",&dGRADE);
if(dGRADE<=100){
if(dGRADE<60){
strcpy(LETTER,"F");
}else if(dGRADE<70){
strcpy(LETTER,"D");
}else if(dGRADE<80){
strcpy(LETTER,"C");
}else if(dGRADE<90){
strcpy(LETTER,"B, so so");
}else if(dGRADE<=100){
strcpy(LETTER,"A, very good");
}
printf("Get %s\\n",LETTER);
}
}while(dGRADE!=1000);
//==========END==========//
system("PAUSE");
return 0;
}
2007-03-12 20:38:00 · answer #1 · answered by Big_John-tw 7 · 0⤊ 0⤋
說一下錯誤訊息可能比較能知道為什麼不能跑吧
不過輸入的地方就有點問題了
grade宣告成int,應該是整數;
不過你scanf的時候又用%f..這個是讀浮點數的呢..
這樣結果一定也是錯的啦 @_@
2007-03-12 20:36:26 · answer #2 · answered by ? 5 · 0⤊ 0⤋