全国计算机二级编程题100道,计算机二级C语言100道编程题
國家計算機二級100道編程題
#include
#include
int fun(int score[], int m, int below[])
{
int i,k=0;
float av=0.0;
for(i=0;i
av=av+score[i];
av=av/m;
for(i=0;i
if(score[i]
below[k++]=score[i];
return k;
}
NONO ( )
{/* 本函數用于打開文件,輸入測試數據,調用fun函數,輸出數據,關閉文件。*/ int i, j, n, below[10], score[10] ;
FILE *rf, *wf ;
rf = fopen("C:\\WEXAM\\YS240001\\in.dat","r") ;
wf = fopen("C:\\WEXAM\\YS240001\\out.dat","w") ;
for(i = 0 ; i < 10 ; i++) {
for(j = 0 ; j < 10 ; j++) fscanf(rf, "%d", &score[j]) ;
n = fun(score, 10, below) ;
for(j = 0 ; j < n ; j++) fprintf(wf, "%d ", below[j]) ;
fprintf(wf, "\n") ;
}
fclose(rf) ;
fclose(wf) ;
}
main( )
{ int i, n, below[9] ;
int score[9] = {10, 20, 30, 40, 50, 60, 70, 80, 90} ;
n = fun(score, 9, below) ;
printf( "\nBelow the average score are: " ) ;
for (i = 0 ; i < n ; i++) printf("%d ", below[i]) ;
NONO() ;
}
總結
以上是生活随笔為你收集整理的全国计算机二级编程题100道,计算机二级C语言100道编程题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ImportError: cannot
- 下一篇: 发放盛大网盘Everbox公测邀请码