PTA——猜数字游戏

程序:

 #include <stdio.h>
int main()
{
int num, times;
scanf("%d %d", &num,&times); int i = , guess;
while(i< times){
scanf("%d", &guess);
if(guess < ){
printf("Game Over\n");
break;
}
if(guess > num){
printf("Too big\n");
}
if(guess < num){
printf("Too small\n");
}
if(guess ==num){
if(i == ){
printf("Bingo!\n");
}else if(i < ){
printf("Lucky You!\n");
}
else{
printf("Good Guess!\n");
}
break;
}
i++;
}
if(i>= times){
printf("Game Over\n");
}
}

主要考察循环和判断

上一篇:c#保留小数点后位数的方法


下一篇:运用SET ANSI_PADDING OFF创建某个字段为自增列的表,以及插入数据