猜拳!路过的,不过我解决不了!求高手!

来源:百度知道 编辑:UC知道 时间:2024/05/01 01:05:17
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int rand(int maxlim)
int judgewin(int h1,int h2)
void disphand(char h)

void main()
{
char man,computer;
char wantplay;

/*重置随机数序列*/
srand( (unsigned)time( NULL ) );

printf("-----------猜 拳--------------\n");
do
{
/*您出拳*/
while(1)
{
printf("您出什么拳?(1--石头 2--剪子 3--布):");
man=getche();
if(man<'1'||man>'3')
printf("您出的不是拳!\n");
else
break;
}
/*显示您出的拳*/
printf("\n您出的是");
disphand(man);
printf("\n");

/*电脑出拳*/
computer=rand(3) + '1';

/*显示电脑出的拳*/
printf("我出的是");
disphand(computer);
printf("\n");

/*判断胜负*/
switch(judgewin(man,computer))
{
case 0: p

你把行数标注出来啊!这样好看点!
第6行是这个吧?
int judgewin(int h1,int h2)

你定义的是一个返回值INT类型的函数,有两个参数int h1,int h2
应该没什么错误啊!

yun

int judgewin(int h1,int h2)
前后定义都缺少分号
还有后面的getchar都打成getche了~
还有68行的定义...该成int judgewin(int h1,int h2);