Skip to content

Instantly share code, notes, and snippets.

@HaruhiroTakahashi
Created June 11, 2015 09:52
Show Gist options
  • Save HaruhiroTakahashi/1d8df7b8c4ceb071b372 to your computer and use it in GitHub Desktop.
Save HaruhiroTakahashi/1d8df7b8c4ceb071b372 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<conio.h>
int main(){
int key = 0;
int com = 0;
int count = 0;
int score1 = 0;
int score2 = 0;
int score3 = 0;
int score4 = 0;
for (count = 5; count > 0; count--){
printf("---NOW SCORE---\n");
printf("勝ち    %d回\n負け    %d回\n引き分け  %d回\nノーカウント   %d回\n『あと%d回遊べるドン!』\n\n",
score1, score2, score3, score4, count);
printf("---Let's Fight!---\n");
printf("何を出しますか? 【 1.グー 2.チョキ 3.パー 】\n");
printf("番号を入れてください > ");
key = _getche();
if (key == 0 || key == 224)key = _getche();
srand((unsigned)time(NULL));
com = (rand() % 2 + 49);
if (key > 48 && key < 52){
printf("\n\n\n");
printf("========RESULT=======\n");
printf("・私の手:");
switch(key){
case 49:
printf("グー \n");
break;
case 50:
printf("チョキ \n");
break;
case 51:
printf("パー \n");
break;
default:
break;
}
printf("・comの手:");
switch (com){
case 49:
printf("グー \n");
break;
case 50:
printf("チョキ \n");
break;
case 51:
printf("パー \n");
break;
default:
break;
}
printf("・結果:");
if (key == com){
printf("DRAW\n\n(o´・∀・`)ちっ 運が良かったな\n\n\n");
score3++;
}
else if (key == 49 && com == 51){
printf("COM WIN\n\n((`・∀・´))ドヤヤヤャャャャ\n\n\n");
score2++;
}
else if (key == 50 && com == 49){
printf("COM WIN\n\n┐(  ̄ー ̄)┌ フッ\n\n\n");
score2++;
}
else if (key == 51 && com == 50){
printf("COM WIN\n\n(゚ε゚)いや弱いね君~♪\n\n\n");
score2++;
}
else{
printf("YOU WIN\n\n( ゚皿゚)キ──ッ!!\n\n\n");
score1++;
}
}
else{
printf("\n\n\n\n\n");
printf("( ´_ゝ`)エラーだよ\n");
printf("※1か2か3を選んでね\n\n\n\n\n\n");
score4++;
}
}
system("cls");
printf("------------------------------------------\n");
printf("おしまい!もう一回やりたかったら再実行だ!\n");
printf("------------------------------------------\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment