当前位置: 移动技术网 > IT编程>开发语言>C/C++ > c语言实现猜数字游戏

c语言实现猜数字游戏

2018年10月13日  | 移动技术网IT编程  | 我要评论
怎么实现猜数字游戏呢?有什么办法呢?接下来红黑小编就来介绍一下c语言实现猜数字游戏的方法,希望对大家有所帮助。
#define _crt_secure_no_warnings 1
#include
#include
#include

void  menu()
  printf("*********1.play***********\n");
  printf("*********0.exit************\n");

int main()
{
  int input = 0;
  srand((unsigned int )time(null));
  do
{
    menu()
    printf(" 请选择;>");
    scanf("%d",&input);
    switch(input)
 {
   case 1:
     int num = rand()%100+1;//产生0-100的随机数
     int guess = 0;
    while(1)
{
  printf("请猜数字:>);
  scanf("%d",&guess);
  if(num>guess)
  {
  printf("猜大啦\n");
  }
  else if(num

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网