首页 > 其他 > 详细

猜数字

时间:2014-10-26 16:49:06      阅读:236      评论:0      收藏:0      [点我收藏+]

#include <stdio.h>
#include <time.h>
int main (void)
{     int num,answer,count=0;
     srand(time(NULL));      
      answer = rand()%100+900;
    while (1){
        printf("请输入您的数字:\n");
        scanf("%d",&num);
        if(num==answer){
            printf("恭喜你!猜对啦!!\n");
            break;
        }
                
        else {
         if(num<answer){
                printf("您的数字小了,、请继续" );}
                else{
                printf("您的数字大了,。请继续");
                           }
                       }        
    }  
getch ();
return 0;
}

猜数字

原文:http://www.cnblogs.com/hellokitty1/p/4052083.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!