#include<time.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
srand((unsigned )time(NULL));
int num=rand();
num=num%100+1;
int guess;
int count=0;
puts("有一個數,你來猜猜看");
while(scanf("%d",&guess))
if(guess<num)
puts("小了");
count++;
}
else if(guess>num)
puts("大了");
else
printf("bingo!!您共用了%d次回答正確\n",++count);
count=0;
break;
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
srand((unsigned )time(NULL));
int num=rand();
num=num%100+1;
int guess;
int count=0;
puts("有一個數,你來猜猜看");
while(scanf("%d",&guess))
{
if(guess<num)
{
puts("小了");
count++;
}
else if(guess>num)
{
puts("大了");
count++;
}
else
{
printf("bingo!!您共用了%d次回答正確\n",++count);
count=0;
break;
}
}
}