问题遇到的现象和发生背景
学校的要求练习
问题相关代码,请勿粘贴截图
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <time.h>
int main()
{
int computerNumber,userNumber;
char ch='y';
bool IsContine=true;
while(IsContine)
{
srand(time(NULL));
computerNumber=(int)(rand()%3);
printf("请输入用户你的选择:0-剪刀 1-石头 2-布\n");
scanf("%d",&computerNumber);
switch(computerNumber)
{
case 0:
if(userNumber == 0)
{
printf("你:剪刀 计算机:剪刀 平局~\n");
}
else if(userNumber == 1)
{
printf("你:石头 计算机:剪刀 你胜利了!\n");
}
else if(userNumber == 2)
{
printf("你:布 计算机:剪刀 很遗憾你输了~\n");
}
break;
case 1:
if(userNumber == 0)
{
printf("你:剪刀 计算机:石头 很遗憾你输了~\n");
}
else if(userNumber == 1)
{
printf("你:石头 计算机:石头 平局~\n");
}
else if(userNumber == 2)
{
printf("你:布 计算机:石头 你胜利了!\n");
}
break;
case 2:
if(userNumber == 0)
{
printf("你:剪刀 计算机:布 你胜利了!\n");
}
else if(userNUmber == 1)
{
printf("你:石头 计算机:布 很遗憾你输了~\n");
}
else if(userNumber == 2)
{
printf("你:布 计算机:布 平局~\n");
}
break
}
printf("是否继续游戏(y/n?)");
getcher();
scanf("%c",&ch);
if(cj==='y'||ch=='y')
IsContine=true;
else IsContine=false;
}
return 0;
}
运行结果及报错内容
3 19 C:\Users\HUAWEI\Desktop\8.c [Error] cstdlib: No such file or directory
compilation terminated.
我想要达到的结果
能跑出来