为什么把程序分成四个文件就运行不了?
求解,什么回事?我把一个程序代码分成四个就运行不了,求解析!但原程序可以运行!程序代码:
#include "stdio.h" #define N 5 #define M 7 void main() { float score[N][M]; extern input_score(score) ; extern count_average(score); extern output_score(score); extern score_sort(score); extern output_score(score); }#define N 5 #define M 7 extern void score_sort(float arr[][M], int n) { int j, k, m, p; float temp ; for (m=0; m<n-1; m++) { k=m ; for (j=m+1; j<n; j++) if (arr[k][M-1]<arr[j][M-1]) k=j ; if (k!=m) { for(p=0; p<M; p++) { temp=arr[m][p] ; arr[m][p]=arr[k][p] ; arr[k][p]=temp ; } } } }#include "stdio.h"
#define N 5
#define M 7
extern void output_score(float arr[N][M])
{ int n, m;
printf (" 学号 课程—1 课程—2 课程—3 课程—4 课程—5 平均成绩\n\n") ;
for ( n=0; n<N; n++)
{ printf (" %6d", (int)arr[n][0] );
for(m=1; m<M; m++)
printf (" %8.2f", arr[n][m]) ;
printf("\n\n") ;
}
}#define N 5
#define M 7
extern void count_average(float arr[][M], int n)
{ float aver ;
int k, m ;
for ( k=0; k<n; k++)
{ aver=0.0 ;
for (m=1; m<M-1; m++)
aver=aver + arr[k][m] ;
arr[k][M-1]=aver/(M-2) ;
}
}#define N 5
#define M 7
#include "stdio.h"
void input_score(float arr[N][M])
{ int n, m;
for ( n=0; n<N; n++)
{ printf(" input NO please:") ;
scanf("%f",&arr[n][0]) ;
printf(" input %d score:\n",M-2) ;
for(m=1; m<M-1; m++)
scanf("%f",&arr[n][m]) ;
printf (" \n\n") ;
}
}