while문 문법을 확인해 보세요~
조민우 님이 쓰신 글 :
: C독학 4일차입니다..
: 맨처음 컴파일러 때문에 고생하다가 터보씨3.1로 잘 하고 있는데(xp)
: 오늘 실행이 안돼는 코드가 발견돼서 이렇게 질문 올립니다.
: 컴파일은 됐구요.
: 다른 소스들의 실행에도 오류는 없습니다만,
:
:
: /*이름 : Find_nbr.c
: *목적 : 이 프로그램은 임의의 수를 선택해서
: * 사용자가 추측하게 한다.
: * 반환 값 :없음
: */
:
: #include<stdio.h>
: #include<stdlib.h>
: #include<time.h>
:
: #define NO 0
: #define YES 1
:
: void main(void)
: {
: int guess_value = -1;
: int number;
: int nbr_of_guesses;
: int done = NO;
:
: printf("\n\nGetting a Random number \n");
:
: /*난수 생성기를 사용할 차례*/
: srand((unsigned) time (NULL));
: number = rand();
:
: nbr_of_guesses =0;
: while (done == NO);
: {
: printf("\nPick a nimber between 0 and %d> " , RAND_MAX);
: scanf("%d",&guess_value);/*숫자를 구함*/
:
: nbr_of_guesses++;
:
: if (number == guess_value)
: {
: done = YES;
: }
: else
: if (number< guess_value)
: {
: printf("\nYou guessed high!");
: }
: else
: {
: printf("\nYou guessed low!");
: }
: }
:
:
: printf("\n\nCongratulations! You guessed right in %d Guesses!",nbr_of_guesses);
: printf("\n\nTHe number was %d\n\n", number);
: }
:
: 요것만 프로그램응답없음이 돼버리는데 혹시 이유를 아시는분 있으신가요?터보씨가 응답없음이 아닌 이프로그램실행
: 이 응답없음이 뜹니다.
: 아무쪼록 한수 가르쳐 주시길 바랍니다.
|