小白今天写的一个猜数游戏,嘿嘿
#include "stdafx.h"
#include "stdio.h"
#include"stdlib.h"
#include"time.h"
#define N 100;
void main()
{
srand(time(0));
int it=rand()%N+1;
printf("我猜了一个数字,你猜猜是多少\n");
int a=0,b=0;
printf("你猜的数字是:");
scanf("%d",&b);
a+=1;
while(b!=it)
{
printf("输错了哦,再来一次吧");
printf("你猜的数字是:");
scanf("%d",&b);
a+=1;
}
printf("你答对了哦,我猜的数字是%d,你用了%d次猜对",it,a);
}