给一些像猜拳这种C++代码

/* Note:Your choice is C IDE */

#include "stdio.h"

#include "stdlib.h"

#define _SRT_RAND_S

void main()

{

int a,sjb[3]={0,1,2};

int i;

int yourhand;

printf("0-石头\n");

printf("1-剪刀\n");

printf("2-布\n");

scanf("%d",&yourhand);

a=rand()%3;

printf("%d\n",a);

for(i=0;i<2;i++)

{ if(yourhand==sjb[i])

{if(sjb[i]==sjb[a])

printf("平局\n");

else if(sjb[i+1]==sjb[a])

printf("胜利\n");

else printf("失败\n");

}

}

if(yourhand==sjb[2])

{

{if(sjb[i]==sjb[a])

printf("平局\n");

else if(sjb[i-2]==sjb[a])

printf("胜利\n");

else printf("失败\n");

}

}

}