Updated the Game
It loops now, and the source is completely organized. I'll upload the exe later.
Edit: Gaah, why cant you edit the source
I'll post it here:
/***********************************
Rock Paper Scissors
My First Game In C++
By Preston "{NWC}Omega" Chaderton
***********************************/
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
//Ready Label For Organization
void Game ();
//Declare 2 Required Long Variables
long playerenter;
long computerenter;
//Main Program
int main()
{
//Print Some Game Info
cout << "My First C++ Game\n";
cout << "Rock, Paper, Scissors v1.1\n";
cout << "By: Preston '{NWC}Omega' Chaderton\n";
cout << endl;
getch();
//Loop the Main Game Until User Closes Command Prompt
for(;;)
{
Game();
}
//Return 0 So the Operating System can Take Back Over
return 0;
}
//Label To Run the Game
void
Game ()
{
//Print Combat Information
cout << "Input Combat Type\n";
cout << "1 is Rock\n";
cout << "2 is Paper\n";
cout << "3 is Scissors\n";
cout << endl;
//Input Combat Style
cin >> playerenter;
//Depending On Data, Print Combat Style
if(playerenter == 1)
{
cout << "Combat Type is Rock";
}
else if(playerenter == 2)
{
cout << "Combat Type is Paper";
}
else if(playerenter == 3)
{
cout << "Combat Type is Scissors";
}
cout << endl;
getch();
//Get Random Number for Computer Combat Style
srand( (unsigned)time( NULL ) );
computerenter = rand() % 3;
//If Random Number is Ever 0, Make it 1
if (computerenter == 0)
{
computerenter = 1;
}
else if (computerenter > 0)
{
computerenter = computerenter;
}
//Depending On Random Number, Print Computers Fighting Style
if (computerenter == 1)
{
cout << "Computer Combat Type is Rock";
}
else if (computerenter == 2)
{
cout << "Computer Combat Type is Paper";
}
else if (computerenter == 3)
{
cout << "Computer Combat Type is Scissors";
}
cout << endl;
getch();
//Heres Where the Magic Begins, Calculate Whether You Win or Lose
if (playerenter == computerenter)
cout << "Tie";
else if (playerenter == 1 && computerenter == 3)
cout << "You Win!";
else if (playerenter == 2 && computerenter == 1)
cout << "You Win!";
else if (playerenter == 3 && computerenter == 2)
cout << "You Win!";
else if (playerenter == 2 && computerenter == 3)
cout << "You Lose...";
else if (playerenter == 1 && computerenter == 2)
cout << "You Lose...";
else if (playerenter == 3 && computerenter == 1)
cout << "You Lose...";
getch();
//Final Message Before Loop
cout << "\n" << endl;
cout << "Next Round!\n" << endl;
getch();
}