제가 지금 풀고있는 문제인데요 제가 한 프로그래밍이
#include <stdio.h>
#define row 5
#define col 4
double sum(int n,double ary[]);
double average(int n,double ary[]);
int main(void)
{
int i,j;
double avg=0.0;
double score[][col]={97,90,88,95,76,89,75,83,60,70,88,82,83,89,92,85,75,73,72,78};
char name[5][10]={"이현수","김기수","김범용","장기태","이명수"};
printf("이름 중간1 중간2 기말1 기말2 합 평균\n");
printf("--------------------------------------------------\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
printf("%10d%10lf%10lf",score[i][j],sum(i,score),average(i,score));
}
puts("");
return 0;
}
double sum(int n,double ary[])
{
int i;
double total=0.0;
if(i==0){
for(j=2;j<5;j++){
total+=ary[i][j];
}
}
else if(i==1){
for(j=2;j<5;j++){
total+=ary[i][j];
}
}
else if(i==2){
for(j=2;j<5;j++){
total+=ary[i][j];}
}
else if(i==3){
for(j=2;j<5;j++){
total+=ary[i][j];}
}
else if(i==4){
for(j=2;j<5;j++){
total+=ary[i][j];}
}
else
for(j=2;j<5;j++){
total+=ary[i][j];
}
return total;
}
double average(int n,double ary[])
{int i;
double total=0.0;
if(i==0)
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
else if(i==1)
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
else if(i==2)
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
else if(i==3)
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
else if(i==4)
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
else
for(j=2;j<5;j++)
total+=ary[i][j];
avg=total/4;
return avg;
}
함수호출 사용해서 이렇게 했는데 자꾸 1개의 알수없는 외부참조라네요.....
이거 어떻게 풀어야 하나요??ㅠㅠㅠㅠ고수님들 부탁드려요..........