How to make rock paper scissor game using C++ ?

Rock / Paper / Scissors [Game] [C++]

void main () {
int a[3][3];
int b = 3, c;
char play[8];
randomize();
a[0][0] = 0;
a[0][1] = -1;
a[0][2] = 1;
a[1][0] = 1;
a[1][1] = 0;
a[1][2] = -1;
a[2][0] = -1;
a[2][1] = 1;
a[2][2] = 0;

b = randomize(b);
cout<<“Rock / Paper / Scissors – By Y-Gaming n n”;
cin<<play;

if (strcmpi(play,”rock”)==0) {
cout<<“You: Rock n”;
c = a[0][b];
}
if (strcmpi(play,”paper”)==0) {
cout<<“You: Paper n”;
c = a[1][b];
}
if (strcmpi(play,”scissors”)==0) {
cout<<“You: Scissors n”;
c = a[2][b];
}

if (b==0)
cout<<“Computer: Rock n”;
if (b==1)
cout<<“Computer: Paper n”;
if (b==2)
cout<<“Computer: Scissors n”;

if (c==1)
cout<<“You Win!”;
else if (c==0)
cout<<“It’s a Tie!”;
else if (c==-1)
cout<<“You Lose!”;
getch();
}



Hey there! I am a proficient (Well, I think so) tech reviewer,Application developer and blogger with good knowledge in Swift,Android and Java. I also have a mediocre knowledge of C,C++,html and php. Other than making awesome things, I am interested in roaming around the town and I love to eat pizza!


'How to make rock paper scissor game using C++ ?' has no comments

Be the first to comment this post!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Images are for demo purposes only and are properties of their respective owners. ©opyright Akshat Jagga 2018

Optimization WordPress Plugins & Solutions by W3 EDGE
%d bloggers like this: