偕謦
Lv 4
偕謦 asked in 電腦與網際網路程式設計 · 1 decade ago

請幫我檢查這個C++的程式語言(20點)

請幫我檢查這個C++的程式語言

為什麼無法執行?

程式碼如下:

#include <stdio.h>

#include <stdlib.h>

int main()

{

int counter;

int grade;

int total;

int average;

total=0;

counter=1;

while (counter<=10){

printf(\"請輸入成績\");

scarf(\"%d\",&grade);

total=total+grade;

counter=counter+1;

}

average=total/10;

printf(\"平均是%d/n\",average);

system(\"PAUSE\");

return 0;

}

1 Answer

Rating
  • adam!
    Lv 5
    1 decade ago
    Favorite Answer

    scarf("%d",&grade);

    -> scanf("%d",&grade);

    printf("平均是%d/n",average);

    ->printf("平均是%d\n",average);

Still have questions? Get your answers by asking now.