Select Menu

Search This Blog

Populer Posts Hari ini

Popular Posts

Powered by Blogger.

Lorem 1

adsense

" });

Circle Gallery

" });

News

" });
» » » Source Code game gunting batu kertas dengan bahasa C

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

void main(){
   int musuh,player;
   char ulang;
   randomize();
   musuh=random(3);
   do{
      printf("ini Permainan Gunting, Batu , Kertas\n");
      printf("\t\t1. Gunting\n");
      printf("\t\t2. Batu\n");
      printf("\t\t3. Kertas\n");
      printf("\nSilahkan Pilih Tanganmu : ");scanf("%d",&player);
      if(musuh==1 && player==1){
            printf("\nCpu = Gunting vs Player = Gunting");
            printf("\nPermainan Seri");
      }
      else if (musuh==1 && player==2){
            printf("\nCpu = Gunting vs Player = Batu");
            printf("\nPemenangnya Player");
      }
      else if (musuh==1 && player==3){
            printf("\nCpu = Gunting vs Player = Kertas");
            printf("\nPemenangnya Cpu");
      }
      else if(musuh==2 && player==1){
            printf("\nCpu = Batu vs Player = Gunting");
            printf("\nPemenangnya Cpu");
      }
      else if(musuh==2 && player==2){
            printf("\nCpu = Batu vs Player = Batu");
            printf("\nPermainan Seri");
      }
      else if(musuh==2 && player==3){
            printf("\nCpu = Batu vs Player = Kertas");
            printf("\nPemenangnya Player");
      }
      else if(musuh==3 && player==1){
            printf("\nCpu = Kertas vs Player = Gunting");
            printf("\nPemenangnya Cpu");
      }
      else if(musuh==3 && player==2){
            printf("\nCpu = Kertas vs Player = Batu");
            printf("\nPemenangnya Cpu");
      }
      else if(musuh==3 && player==3){
            printf("\nCpu = Kertas vs Player = Kertas");
            printf("\nPermainan Seri");
      }

      else{
            printf("Masukan anda salah");
      }

      printf("\n\n\tIngin main lagi (y/t) : ");scanf("%s",&ulang);
      clrscr();
   }while(ulang=='y'||ulang=='Y');
getch();

}

About andi

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply