Help With Rock Paper Scissors

I i have to make a Rock Paper Scissors Lizard Spock program, and im having trouble getting the computer choice to randomly choose a number from 0 - 4 to make a random choice. Please show me what I am doing wrong. This is wha tI have so far

#include <iostream>
#include <cstdlib>
using namespace std;

void ShowProgramHeader();
int main()
{
int PlayerChoice;


void ShowProgramHeader();
{


cout <<" Ben Abeln " << endl;
cout <<" June 29th 2011 " << endl;
cout <<" Computer Science 120 " << endl;
cout <<"----------------------" << endl;
}

void Intro();
{



cout <<" Welcome to Rock, Paper, Scissors, Lizard, Spock " << endl;
cout <<" " << endl;
cout <<" Rules of the game : " << endl;
cout <<" Scissors cuts Paper covers Rock crushes Lizard poisons Spock smashes" << endl;
cout <<" Scissors decapitates Lizard eats Paper disproves Spock vaporizes Rock crushes" << endl;
cout <<" Scissors " << endl;
cout <<" " << endl;
cout <<" Please choose your choice: 1 = Rock, 2 = Paper " << endl;
cout <<" 3 = Scissors, 4 = Lizard, 5 = Spock " << endl;

cin >> PlayerChoice;

}

if ( PlayerChoice == 1 )
{


cout <<" Player Chooses: Rock " << endl;
}

else if ( PlayerChoice == 2 )
{

cout <<" Player Chooses: Paper " << endl;
}

else if ( PlayerChoice == 3 )
{

cout <<" Player Chooses: Scissors " << endl;
}

else if ( PlayerChoice == 4 )
{

cout << " Player Chooses: Lizard " << endl;
}

else if ( PlayerChoice == 5 )
{

cout << " Player Chooses: Spock " << endl;
}

int CompChoice;
char CompChar;

CompChoice = rand() % 5 ;

if ( CompChoice == 0 )
{
CompChar = 'Rock';
cout << " Computer Chooses: Rock " << endl;
}

else if ( CompChoice == 1 )
{
CompChar = 'Paper';
cout << " Computer Chooses: Paper " << endl;
}

else if ( CompChoice == 2 )
{
CompChar = 'Scissors';
cout << " Computer Chooses: Scissors " << endl;
}

else if ( CompChoice == 3 )
{
CompChar = 'Lizard';
cout << " Computer Chooses: Lizard " << endl;
}
else if ( CompChoice == 4 )
{
CompChar = 'Spock';
cout << " Computer Chooses: Spock " << endl;
}


return 0;
}





But when I test it out, the computer chooses the same thing every time

HELP
The rand() function uses a technique that allows it go generate random numbers based on a seed, but the seed starts off the same each time you run your program you need to use the srand() function and change the seed to, say, the system time in seconds, so it will always be different every time you run you application.

Also, this: CompChar = 'Lizard';, and all the other places you have more than one character inside signle character quotes, is wrong. You cannot assign multiple characters to one character - good compilers will give you an error for this.
Thank you for your help!
Topic archived. No new replies allowed.