//
// main.m
// aaa
//
// Created by VincentFu on 15/7/9.
// Copyright (c) 2015年 Myo. All rights reserved.
//
#import <Foundation/Foundation.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
int computer = -1,player = -1;
computer = arc4random_uniform(3);
printf("出拳!!!!!!\n 0.剪刀 1.石头 2.布\n");
scanf("%d",&player);
if (player ==0 ) {
printf("你出:剪刀\n");
}else if(player ==1){
printf("你出:石头\n");
}else if(player==2){
printf("你出:布\n");
}
if (computer ==0 ) {
printf("电脑出:剪刀\n");
}else if(computer ==1){
printf("电脑出:石头\n");
}else if(computer==2){
printf("电脑出:布\n");
}
if(player<0 || player>2){
printf("你输错了吧?");
return 0;
}
if((player==0&&computer==2)||
(player==1 && computer==0)||
(player==2 && computer==1)){
printf("你赢了!!!!!\n");
}else if ((computer==0&&player==2)||
(computer==1 && player==0)||
(computer==2 && player==1)){
printf("你输了了!!!哈哈哈哈!!\n");
}else{
printf("平局!!!\n");
}
return 0;
}