파일 입출력 함수 반복문 ..
초고리
void input() //input
{
char name[10], count;
int kor, eng, mat;
FILE *fp; // 파일이름을 fp로 하겟다 선언
fp=fopen(d:\\xxx\\score.txt,a);
if(fp == NULL){
cout파일 열기 오류 (score.txt);
getch();
return;
}//if end
system(cls);while(1){
cout 이름: ;cinname;
cout 국어: ;
cinkor;
cout 영어: ;
cineng;
cout 수학: ;
cinmat;
fprintf(fp,%s %d %d %d \n, name, kor, eng, mat);
coutendl계속 입력을 하시 겠습니까?(Y,N);
count=getche();
if(count==89 || 121){
coutendl;
continue;
}
fclose(fp);
break;
}while end
} //input end
실행하면 결과에 상관 없이
if(count==89 || 121){
coutendl;
continue;
가 실행이 되는데 break가 실행이 되는데 왜 이런 것인가요?
제가 배운 이론상으로 따지면 Y를 제외한 숫자가 입력이 된다면
if(count==89 || 121){
coutendl;
continue;
}
에서 거짓말로 판정이 되서 다음줄이 실행이 되는 걸로 알고 있습니다.
하지만 실행을 해보면 무한 반복이 되고 있습니다 도와 주세요