제가 짠 프로그램 어디에 문제가 있나요?
텃골돌샘터
질문 제목 : 10 이하의 정수 n을 입력받은 후 n명의 이름(한글 4글자이하)과 세 과목의 점수를 입력받아 총점이 높은 순으로 정렬하여 출력하는 프로그램을 작성하시오.질문 요약 :10 이하의 정수 n을 입력받은 후 n명의 이름(한글 4글자이하)과 세 과목의 점수를 입력받아 총점이 높은 순으로 정렬하여 출력하는 프로그램을 작성하시오 이거 아래처럼작성햇는데출력이 이상하게 나와요질문 내용 :
#include stdio.h
#include stdlib.h
typedef struct score
{
char name[4];
int score1;
int score2;
int score3;
int total;
} score;
int main(int argc, char *argv[])
{
score student[10], tmp;
int i, amount, j;
scanf(%d, &amount);
for(i=0; iamount; i++)
{
scanf(%s %d %d %d, &student[i].name, &student[i].score1, &student[i].score2, &student[i].score3);
student[i].total=student[i].score1+student[i].score2+student[i].score3;
}
for(i=0; iamount-1; i++)
{
for(j=amount-1; j=1; j--)
{
if(student[j].totalstudent[j-1].total)
{
tmp=student[j];
student[j]=student[j-1];
 sp; student[j-1]=tmp;
}
}
}
for(i=0; iamount; i++)
{
printf(%s %d %d %d\n, student[i].name, student[i].score1, student[i].score2, student[i].score3);
}
system(pause);
return 0;
}