求教一道c语言题?c语言高手请进。急急急!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/09 02:43:36
课题:猜数游戏(cs.c)

功能要求:计算机产生随机数,猜中即胜,猜不中,提示是大了还是小了,继续猜,直至猜到,给出所用时间和评语。

界面要示:简洁
要求提供完整的c语言程序,并根据你的算法画出完整的流程图来。源程序经编译通过并有完整流程图者,将追加10分。

现在公司项目忙,没时间上百度写程序了,简单写了一下,剩下的你完善!

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

void main( void )
{
int temp, n;
srand((unsigned)time(NULL));
temp=rand();
temp=temp%10;

a: printf("\输入你猜的数");
scanf("%d",&n);
if (temp == n)
{
printf("\n真聪明,猜对了!\n");
}
else if (n < temp)
{
printf("\n猜小了,继续猜!\n");
goto a;
}
else
{
printf("\n猜大了,继续猜!\n");
goto a;
}
}

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void main(void)
{
int num,guess;
srand((unsigned int)time(NULL));
num=rand()%500;
printf("%d\n",num);
do
{
printf("please input the number you guess:");
scanf(