게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
While문 질문입니다ㅠㅠ
게시물ID : programmer_10876짧은주소 복사하기
작성자 : 슈퍼코리안
추천 : 0
조회수 : 317회
댓글수 : 9개
등록시간 : 2015/06/05 11:58:00
옵션
  • 본인삭제금지
#include<stdio.h> 
int main(void)
{
int score, num;
int max, maxnum;
int min, minnum;
int total, cnt;
double avg;
int rtn;

printf("번호,점수-->");
rtn = scanf("%d, %d", &num, &score);

cnt = 0;

max = score;
min = score;

maxnum = max;
minnum = min;

if (rtn == EOF)
{
printf("입력값없음");
}

else
{
while (rtn != EOF && score <= 100 && score >= 0)
{
cnt =+ 1;
total =+ score;

if (max < score)
{
max = score;
maxnum = num;
}

else if (max > score) 
{
min = score; 
minnum = num; 
}
}

printf("번호,점수-->");
rtn = scanf("%d, %d", &num, &score);
}

avg = (double)total / cnt;
printf("\n평균:%3.1f", avg);
printf("\n최대점  번호: %d 점수 : %d", maxnum, max); 
printf("\n최저점  번호: %d 점수: %d", minnum, min);

return 0;
}

같은 문제로 삼일째 고생하고 있습니다ㅠㅠ
자꾸 원하는 결과가 안나와서 처음부터 다시 썼는데 rtn에서 에러가 나오네요ㅠㅠ 
이유가 뭘까요ㅠㅠ
그리고 무시하고 실행해도 반복문으로 안들어가네요ㅠㅠ 
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호