猜数字(C语言随机生成1-100)

#include
#include
#include
#include
using namespace std;
int main()
{
    char next;
    int shu,shu1;
    do
    {
        shu=rand()%100+1;
        system("cls");
        printf("请输入一个1-100的数: ");
        scanf("%d",&shu1);
        getchar();
        while(shu1!=shu)
        {
            if(shu1               {
                    printf("小了\n再输入一个数吧 ");
                    scanf("%d",&shu1);
               }
            if(shu1>shu)
               {
                   printf("大了\n再输入一个数吧 ");
                   scanf("%d",&shu1);
               }
        }
        printf("恭喜你,猜对了!!!\n");
         getchar();
        printf("还要玩吗?y/n\n");
        next=getchar();
        getchar();
    }
    while(next=='y'||next=='Y');
}

你可能感兴趣的:(C的无聊)