又是一個程式...

計算分數更程式的=~=

#include
#include


void aa(void){

int i,no,sum;
double average;
int scores[3][2] = {{74,56},
{37,68},
{33,83}};

do{
printf ("輸入學號 0 ~ 2 (-1為結束) = > ");
scanf ("%d",&no);
if (no < 0) break;

for (sum = 0 , i = 0 ; i < 2; i++){
sum += scores[no][i];
printf("成績: %d\n",scores[no][i]);
}
} while(1);
}
void bb(void){
int i,no,sum;
double average;
printf("學號:%d 成績總分:%d",no,sum);
average = sum / 2.0 ;
printf("平均成績:%.3f\n",average);
}

int main(void){

aa();
bb();

system("PAUSE");
return 0;}

krad2007 發表在 痞客邦 PIXNET 留言(0) 人氣()