|
c언어 배운지 한달 됐구요. 에러가 나네요
10명의 성적을 입력받아 평균을 구하고 출력하는 프로그램인데 declaration syntax error가 나요..
이것좀 잡아주시면 용기 백배하겟습니다....
#include<stdio.h>
struct score {
char name[10];
char no[4];
int kor;
int eng;
int math;
int total;
float avg;
};
struct score st[10]; /*구조체 변수 st 선언*/
float average(int total) /*평균값 avg함수의 선언 */
main()
{
int i;
int total;
float avg;
for(i=0;i<10;i++)
printf("\n enter name, no and score orderly manner");
printf("\n input student name");
scanf("%s",st[i].name);
printf("\n input his(her) number");
scanf("%s",st[i].no);
printf("\n input his(her) korean score");
scanf("%d",st[i].kor);
printf("\n input his(her) english score");
scanf("%d",st[i].eng);
printf("\n input his(her) mathematic score");
scanf("%d",st[i].math);
st[i].total=st[i].kor+st[i].eng+st[i].math;
avg=average(st[i].total); /*호출함수로 실매개변수 사용 */
scanf("%f",st[i].avg);
printf("\n\n");
for(i=0;i<10;i++)
printf("학번 이름 국어 영어 수학 평균 \n");
printf("%-8s%-8s%4d%4d%4d%4f\n",st[i].name,st[i].no,st[i].kor,st[i].eng,st[i].math,st[i].avg);
}
{
float average(int total) /*평균값 avg함수의 정의*/
{
return ((total)/3);
}
}
|