실행하면 그냥 바로 윈도우로 나와져버리네
#include<stdio.h>
int studentnumber; // 학번
int kors, engs, maths; //국어,영어,수학 점수
float base, aver, totalaver; //평균점합산, 평균점, 총합의 평균
int count = 0; //실행횟수 카운트
float max_aver = 0;
int max_kors = 0;
int max_engs = 0;
int max_maths = 0;
//각값의 최대값
void inputdata(); //데이터 입력
void calc(); //계산
void printresult(); //출력
int main(void)
{
void inputdata();
void calc();
return 0;
}
void inputdata()
{
int studentnumber = 1;
while(studentnumber == 0)
{
printf(\"Enter the student number : \");
scanf(\"%d\", &studentnumber);
if (studentnumber != 0)
{printf(\"Enter the score for the KOREAN class : \");
scanf(\"%d\", &kors);
printf(\"Enter the score for the ENGLISH class : \");
scanf(\"%d\", &engs);
printf(\"Enter the score for the MATH class : \");
scanf(\"%d\", &maths);
count++;
calc();}
else if (studentnumber == 0)
printresult;
}
}
void calc()
{
aver = (kors+engs+maths)/3;
base += aver;
if (max_aver < aver)
max_aver = aver;
if (max_kors < kors)
max_kors = kors;
if (max_engs < engs)
max_engs = engs;
if (max_maths < maths)
max_maths = maths;
printf(\"-------------------------------------------------------\\n\");
printf(\" Student NO : %d\\n\", studentnumber);
printf(\" KOREAN : %d\\n\", kors);
printf(\" ENGLISH : %d\\n\", engs);
printf(\" MATH : %d\\n\\n\", maths);
printf(\" AVERAGE : %.1f\\n\", aver);
printf(\"-------------------------------------------------------\\n\");
}
void printresult()
{
totalaver = base/count;
printf(\"-------------------------------------------------------\\n\");
printf(\" S T U D E N T T O T A L S C O R E\\n\");
printf(\"-------------------------------------------------------\\n\\n\");
printf(\" TOTAL SCORE : %f\\n\\n\", totalaver);
printf(\" Number of Students : %d\\n\", count);
printf(\" MAX SCORE [AVERAGE]: %f\\n\", max_aver);
printf(\" MAX SCORE [KOREAN] : %d\\n\", max_kors);
printf(\" MAX SCORE [ENGLISH]: %d\\n\", max_engs);
printf(\" MAX SCORE [MATH] : %d\\n\\n\", max_maths);
printf(\"-------------------------------------------------------\\n\\n\");
}
모가 문제일랑가
뭔가 오묘한코드다 ㅋㅋ 컴파일에러가 안뜨나
함수호출하는 꼬라지하고는ㅉㅉㅉㅉㅉㅉㅉㅉㅉㅉㅉㅉ
ㄴ형 내가 초보라그레 욕만하지말고 어떤걸 고쳐야하는지 알려줘 ㅠㅠ