이전 질문 게시판은 새 글 쓰기를 막았습니다. [질문 게시판]을 이용바랍니다.
Date |
2010/10/30 22:39:06 |
Name |
Maphacker |
Subject |
C언어에서 Just-In-Time 에러는 뭔가요? |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ( void ){
int go = 1;
while(go == 1){
int rnumber;
int answer;
srand( time( NULL ) );
rnumber = (1 + rand() % 1000);
answer = firstguess();
if(rnumber == answer){
go = replaygame();
}
else{
while(compare( answer, rnumber) == 1){
scanf("%d", &answer);
}
go = replaygame();
}
}
}
int firstguess ( void ){
int firstanswer;
printf("I have a number between 1 and 1000.n");
printf("Can you guess my number?n");
printf("Please type your first guess.");
scanf("%d", &firstanswer);
return firstanswer;
}
int compare ( int a, int b ){
if ( a < b ){
printf("Too low. Try again.n");
return 1;
}
if ( a > b ){
printf("Too high. Try again.n");
return 1;
}
if ( a == b){
return 0;
}
}
int replaygame( void ){
char replay;
printf("Excellent! You guessed the number!n");
printf("Would you like to play again (y or n)? n");
fflush(stdin);
scanf("%c", &replay);
if( strcmp(replay, "y") == 0){
return 1;
}
else{
return 0;
}
}
이렇게 코드를 짰는데
replay를 int로 정의하고 1일때 if가 작동하게 하면 되는데
문자열 y일때 작동하게 하려니까 계속 저 에러가 나네요ㅠㅠ 도와주세요
|
통합규정 1.3 이용안내 인용
"Pgr은 '명문화된 삭제규정'이 반드시 필요하지 않은 분을 환영합니다.
법 없이도 사는 사람, 남에게 상처를 주지 않으면서 같이 이야기 나눌 수 있는 분이면 좋겠습니다."
|