刚学C语言,写个石头剪刀布玩玩:
石头扣0,剪刀扣1,布扣2,不玩了 >= 3 ;
ps: 其实是我信息书上的项目,看不顺眼,自己搞了个;
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
srand((unsigned int) time(NULL));
unsigned int input,bitch,i;
static char tools[4][9] = {"Rock","Scissors","Paper","LLL"};
for(i = 0;i < 4;i++)
printf("%u.%s ",i,tools[i]);
printf("\n");
while(input < 3)
{
scanf("%1u",&input);
bitch = rand() % 3;
printf(
(input < 3) ? "%s [%s & %s]\n" : "Exited",
(input == bitch) ? ":()" : ((input + 1) % 3 == bitch) ? ":)" : ":( ",
tools[input],tools[bitch]
);
}
return 0;
}
第一次写博客,有点随便XD;