|
-
December 5th, 2010, 10:10 PM
#1
a few questions
i am creating a game of Rock, paper, Scissors,
Code:
#include <iostream>
#include <string>
using namespace std;
string a;
int b;
int main()
{
cout << "Welcome to Rock, Paper, Scissors\n";
cout << "To play, Simply type R,P or S\n";
cout << "\n";
system("PAUSE");
system("CLS");
//Game Begins
cout << "Your turn, R,P or S?\n";
cin >> a;
if (a == "R")
{cout << "You chose Rock..\n";}
else if (a == "P")
{cout << "You chose Paper..\n";}
else if (a == "S")
{cout << "You chose Scissors\n";}
else
{cout << "Please enter R,P or C only\n";}
system("PAUSE");
}
First off, How can i get the code to Start again after "Please enter R,P or C only" so it dosent have to restart?,
And, How can i make a random number generator, that randomly picks one number, from 3, so 1,2,or 3,?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|