求教C语言高手!!!!!急.....所有分全给了

来源:百度知道 编辑:UC知道 时间:2024/06/11 11:43:50
设计一个小程序,系统随机读取0-99内的一个数字,猜出该数字。如果猜错,给出大小提示。给出猜出数字所用的时间,并根据时间的大小判断一个人的反应快慢。
相关函数:srand();clock();
第一个和第三个错误很多,第二个是对的,不过跟我的题目有点出入,我是要求总的猜数字时间和来判断出一个人的反应快慢,不是猜一次的时间,所以,你能继续帮我改一下吗??谢谢了

完全原创,已经编译运行确认:

#include <conio.h>
#include <stdio.h>

#include<stdlib.h>
#include<time.h>

#define N 60 //这儿就是判断反应快慢的标准,我现在选的是60秒

void main()
{
char control='\0';
int rand1,guess;
clock_t start, finish;

srand( (unsigned)time( NULL ) );

printf("开始游戏吗 ?(Y/N)");
control=getchar();
while(control!='y'&&control!='Y'&&control!='n'&&control!='N')
{
printf("无效字符!开始游戏吗 ?(Y?N)");
fflush(stdin);
control=getchar();
printf("%c",control);
}

while((control=='y')||(control=='Y'))
{
system("cls");
srand((unsigned)time(NULL));
rand1=rand()%100;

while(1)
{
printf("请输入你猜的数(输入-1退出本次猜数):");
start = clock();
fflush(stdin);
scanf(&quo