資源簡介
a game
代碼片段和文件信息
#include
#include
#include
int?main()
{
int?playerInput;
int?npcInput;
srand(time(NULL));
while?(1)
{
printf(“請出拳!“);
printf(“1為石頭,2為剪刀,3為布:“);
scanf(“%d“?&playerInput);
switch?(playerInput)
{
case?1:
printf(“你出的是石頭!\n“);
break;
case?2:
printf(“你出的是剪刀!\n“);
break;
case?3:
printf(“你出的是布!\n“);
break;
default:
printf(“輸入錯誤!\n“);
break;
}
npcInput?=?rand()?%?
評論
共有 條評論