急求 用C语言编写猜数游戏程序设计及其流程图(传统流程图或结构化流程图)和程序代码(关键部分加注释)

2020-06-30 游戏 137阅读
#include
#include
#include
void main()
{
        int ran;
        int n;
        int count=0;
        srand((unsigned)time(NULL));
        ran=rand()%100+1;
        while(1)
        {
                printf("Please Input:\n");
                scanf("%d",&n);
                if(n>100||n<1)
                {
                        printf("Input error\n");
                        return;
                }
                if(n                {
                        printf("Input min\n");
                        count++;
                        continue;
                }else if(n>ran)
                {
                        printf("Input max\n");
                        count++;
                        continue;
                }else
                {
                        printf("conguratulation!\n");
                        count++;
                        break;
                }
        }
        if(count<3)
                printf("Very good\n");
        else if(count>=3&&count<=5)
                printf("Good\n");
        else
                printf("You can do better\n");
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com