Game Batu, Kertas, Gunting dengan C++

Pertanyaan umum seputar distribusi Ubuntu yang menjadi distro wajib members ubuntu-indonesia.com
User avatar
_Newbie_
Posts: 188
Joined: 19 Dec 2010, 17:29

Game Batu, Kertas, Gunting dengan C++

Postby _Newbie_ » 24 Mar 2011, 04:15

Ane baru nyo ne Game Lumayan buat refreshing

ne source code-nya....

_Newbie_ wrote:#include
#include
#define menang 3

using namespace std;

char PilihanAcak(){
char pilihan;
srand(time(NULL)); //kunci pembangkit atau disebut umpan bilangan acak
int isi = rand()%3;//menampilkan bilangan acak yang diberikan ke fungsi srand().

switch(isi){
case 0 : pilihan='b';break;
case 1 : pilihan='k';break;
case 2 : pilihan='g';break;
}
return pilihan;
}
int SiapaPemenang(char c,char d){
switch (c){
case 'b' :
if (d=='g') return 1;
else if (d=='k') return 2;
else return 0;
case 'k' :
if (d=='b') return 1;
else if (d=='g') return 2;
else return 0;
case 'g' :
if (d=='k') return 1;
else if (d=='b') return 2;
else return 0;
default :
return -1;
}
}

main(){


atas :
system("clear");
char kamu, aku;
int Pemenang;
int PointMu =0;
int PointKu =0;
char ulang;


do{
cout>kamu;

aku = PilihanAcak();
cout Pointmu : "PointKu){
cout>ulang;

if (ulang == 'Y' || ulang =='y'){
goto atas;
}else{
system("clear");
}
}


dicompile dulu habis itu jalanin deh

Mantap Jaya...

:D
User avatar
lisnux
Posts: 1763
Joined: 02 Jan 2010, 16:26
Location: Samarinda
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby lisnux » 24 Mar 2011, 20:21

wew mastah C++ :grin:
User avatar
noha
Posts: 4
Joined: 25 Mar 2011, 09:52
Location: Semarang
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby noha » 25 Mar 2011, 10:18

makasih banyak.... :cool:

saya boleh minta diajari c++????

maaf msh newbie..

terimakasih :D
User avatar
rhecizen
Posts: 427
Joined: 09 Jan 2010, 20:41
Location: Indonesia
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby rhecizen » 25 Mar 2011, 11:04

keren bro,,,
:D
User avatar
_Newbie_
Posts: 188
Joined: 19 Dec 2010, 17:29

Re: Game Batu, Kertas, Gunting dengan C++

Postby _Newbie_ » 25 Mar 2011, 16:10

lisnux wrote:wew mastah C++ :grin:

gak bro lagi belajar z............

noha wrote:makasih banyak.... :cool:

saya boleh minta diajari c++????

maaf msh newbie..

terimakasih :D


saya juga masih belajar c tapi boleh kok kalau mau sharing... sekalian saya belajar.........

rhecizen wrote:keren bro,,,
:D


thank bro
User avatar
tarantul4
Posts: 42
Joined: 22 Feb 2010, 10:47
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby tarantul4 » 03 Apr 2011, 09:14

mantaappp gaaannn.........100 buat ente......^_^
User avatar
rhecizen
Posts: 427
Joined: 09 Jan 2010, 20:41
Location: Indonesia
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby rhecizen » 07 Apr 2011, 00:16

tapi saya kok menang trus ya, hahahahahaha
User avatar
_Newbie_
Posts: 188
Joined: 19 Dec 2010, 17:29

Re: Game Batu, Kertas, Gunting dengan C++

Postby _Newbie_ » 07 Apr 2011, 08:44

rhecizen wrote:tapi saya kok menang trus ya, hahahahahaha


Sama bro Ane Juga menang Terus....

:D
User avatar
arafiq
Posts: 6
Joined: 08 Apr 2011, 00:58
Location: surabaya, Indonesia
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby arafiq » 08 Apr 2011, 01:28

saya kompile di dev c++ kok ga bs?? knp ya??
" the system cannot find the file specified "
User avatar
saa7_go
Posts: 464
Joined: 21 Jan 2011, 23:37
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby saa7_go » 08 Apr 2011, 07:33

dev c++ ya, kok malah nyoba di windows...

ganti

Code: Select all

system("clear");


jadi

Code: Select all

system("cls");
User avatar
reeyz
Posts: 44
Joined: 17 May 2011, 20:06
Location: dimana Q berpijak

Re: Game Batu, Kertas, Gunting dengan C++

Postby reeyz » 07 Jul 2011, 16:08

ijin sedot



=================================
http://www.4rtblog.blogspot.com
nnewbie
=================================
gapai ilmu sampai mati
User avatar
masdana
Posts: 718
Joined: 08 Jun 2010, 13:09
Location: East Borneo
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby masdana » 07 Jul 2011, 16:36

wah, keren, tapi cara kompilenya piye ? :grin:
User avatar
SinauUbuntu
Posts: 168
Joined: 03 Mar 2011, 11:20
Location: surabaya,indonesia

Re: Game Batu, Kertas, Gunting dengan C++

Postby SinauUbuntu » 08 Jul 2011, 07:57

wooo, seruuu!!!!
User avatar
rizaaal
Posts: 1212
Joined: 01 May 2011, 16:02
Location: Bekasi, Indonesia
Contact:

Re: Game Batu, Kertas, Gunting dengan C++

Postby rizaaal » 08 Jul 2011, 09:16

pengen nyobain, tapi sama sekali buta programming. >.<
User avatar
SinauUbuntu
Posts: 168
Joined: 03 Mar 2011, 11:20
Location: surabaya,indonesia

Re: Game Batu, Kertas, Gunting dengan C++

Postby SinauUbuntu » 12 Jul 2011, 15:44

...
#define menang 3


fungsinya apa???
User avatar
_Newbie_
Posts: 188
Joined: 19 Dec 2010, 17:29

Re: Game Batu, Kertas, Gunting dengan C++

Postby _Newbie_ » 04 Dec 2011, 17:05

Buat Konstanta mas bro sinauubuntu
User avatar
SinauUbuntu
Posts: 168
Joined: 03 Mar 2011, 11:20
Location: surabaya,indonesia

Re: Game Batu, Kertas, Gunting dengan C++

Postby SinauUbuntu » 04 Dec 2011, 17:08

wew, hidup lagi...

Makasih. :)
User avatar
_Newbie_
Posts: 188
Joined: 19 Dec 2010, 17:29

Re: Game Batu, Kertas, Gunting dengan C++

Postby _Newbie_ » 04 Dec 2011, 17:49

sama-sama :D

Return to “Pertanyaan Umum”

Who is online

Users browsing this forum: No registered users and 1 guest