请问谁有C语言的猜数字和反猜数字的源程序

来源:百度知道 编辑:UC知道 时间:2024/05/08 02:23:03
就是0-9有四个数 一种是电脑出你猜,另一种是你出电脑来猜!几A 几B的形式 谢谢了!!!

第一种:

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

int main(int argc, char *argv[])
{
int x;//储存随机生成的要猜的数字
int i;
int iUserguess;//猜的数字
int iSelect;//选择的难度
//====================================================
for(;;)
{
printf("==========================================\n");
printf("Welcome to use the number puzzle.\n");
printf("Select the level:\n");
printf("1>Easy(0-30)\n");
printf("2>Normal(0-50)\n");
printf("3>Hard(0-100)\n");
printf("4>Quit\n");
printf("==========================================\n");

scanf("%d",&iSelect);

switch(iSelect)
{
case 1:
x = rand()%30;