게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
c언어 성적처리프로그램 소스 좀 봐주실수 있나요 ??ㅠㅠ
게시물ID : programmer_20772짧은주소 복사하기
작성자 : 토왕
추천 : 0
조회수 : 1201회
댓글수 : 6개
등록시간 : 2017/06/07 03:55:37
옵션
  • 본인삭제금지



#include <stdio.h>
#include<stdlib.h>

typedef struct su {

char bun[10];
char name[10];
int kor, eng, math, total;
double avg;

}SU;

int main(void) {

int i = 0, n, m, count;

SU people[100], temp;
SU total1 = { "","",0,0,0,0,0 };

printf("성적 처리할 학생들 수 ");
scanf("%d", &count);

for (i = 0; i < count; i++) {

printf("%d번째 학생의 학번을 입력하세요", i + 1);
scanf("%s", people[i].bun);
printf("%d번째 학생의 이름을 입력하세요", i + 1);
scanf("%s", people[i].name);
printf("%d번째 학생의 국어점수을 입력하세요", i + 1);
scanf("%d", people[i].kor);
printf("%d번째 학생의 영어점수을 입력하세요", i + 1);
scanf("%d", people[i].eng);
printf("%d번째 학생의 수학점수을 입력하세요", i + 1);
scanf("%d", people[i].math);

people[i].total = people[i].eng + people[i].kor + people[i].math;

people[i].avg = people[i].total / 3;
total1.kor = total1.kor + people[i].kor;
total1.eng = total1.eng + people[i].eng;
total1.math = total1.math + people[i].math;
total1.total = total1.total + people[i].total;
total1.avg = total1.avg + people[i].avg;
}

for (n = 0; n < count - 1; n++) {
for (m = n + 1; m < count; m++) {
if (people[n].total < people[m].total) {
temp = people[n];
people[n] = people[m];
people[m] = temp;


}

}

}
 
printf("학번 \t 이름   국어  영어 수학 총점 평균\n");

for (i = 0; i < count; i++)
{
printf("%12s %12s %7d %7d %7d %7d %7.2f\n", people[i].bun, people[i].name, people[i].eng, people[i].kor, people[i].math, people[i].total, people[i].eng);
}
printf("%12s %12s %7d %7d %7d %7d %7.2f\n", total1.bun, total1.name, total1.eng, total1.kor, total1.math, total1.total, total1.eng);
printf("%12s %12s %7.2f %7.2f %7.2f %7.2f %7.2f\n", total1.bun, total1.name, total1.eng/(double)count, total1.kor / (double)count, total1.math / (double)count, total1.total / (double)count, total1.avg / (double)count);


return 0;

}

책에 있는대로 하고 있는데  똑같이 적었는데  이렇게 오류가 뜨네요 .. scanf 쪽에 무슨 문제가 있는건가요 ???
qq.PNG

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호