PTA 猜数字游戏

#include
int main()
{
  int random,N,count;
  scanf("%d %d ",&random,&N);
  int i;
  count=0;
 do
  {
    scanf("%d",&i);
    if(i>=0)
    { 
      count++;
      if(i==random)
      {
        break;
      }else if(i>random)
      {
        printf("Too big\n");
      }else
      {
        printf("Too small\n");
      }
    }else
    {
    printf("Game Over\n"); 
    count=0;
    break;
    }
  }while(count<=N);
  if(count==1)
  {
    printf("Bingo!\n");
  }else if(count<=3&&count>0)
  {
    printf("Lucky You!\n");
  }else if(count<=N&&count>3)
  {
    printf("Good Guess!\n");
  }else if(count>N)
  {
    printf("Game Over\n");
  }
  return 0;
}

 

你可能感兴趣的:(C语言基础题库之编程题,个人练习)