PTA 猜數字遊戲

#include<stdio.h>
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;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章