8.4 一个拖沓且错误的猜数字程序

8.4 guess.c -- 一个拖沓且错误的猜数字程序

#include <stdio.h>
int main(void)
{
    int guess = 1;
    printf("Pick an integer from 1 to 100. I will try to guess ");
    printf("it. 
Respond with a y if my guess is right and with");
    printf("
an n if it is wrong.
");
    printf("Uh... is your number %d?
", guess);
    while (getchar()  != 'y')       /*  获取响应, 与 y 做对比  */
        printf("Well, then, is it %d?
", ++guess);
    printf("I knew I could do it!
");

    return 0;
}
原文地址:https://www.cnblogs.com/EisNULL/p/10828908.html