猜數字程式 問題

int main(void)

{

int answer = 48;

int low = 1, high = 100;

int guess = 0;

while(guess!=answer)

{

printf("請在%d到%d中猜一個數字:", low, high);

scanf("%d", &guess);

if(guess>answer)

{

guess = high;

}

else

{

guess = low;

}

}

}

假如我輸入的guess比answer大了話   我想將guess定義成High   反之則是low

再麻煩大大解題了


TofuLeeyanting
浏览 1038回答 1
1回答

C_can

guess = high;guess = low;你这个反了吧
打开App,查看更多内容
随时随地看视频慕课网APP