can someone help me to turn compChoice, userChoice,and determining winner to functions?

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

int main()
{
int PlayerChoice;
int compChoice;

void Intro();
{
cout <<" Welcome to Rock, Paper, Scissors, Lizard, Spock " << endl;
cout <<" Scissors cuts Paper covers Rock crushes Lizard poisons Spock smashes Scissors decapitates Lizard eats Paper disproves Spock vaporizes Rock crushes Scissors " << endl;
cout <<" " << endl;
cout <<" Please choose your choice: 1 = Rock, 2 = Paper " << endl;
cout <<" 3 = Scissors, 4 = Lizard, 5 = Spock " << endl;
cin >> PlayerChoice;
}
int CompChoice;
srand(time(0));
CompChoice = rand() % 5 + 1;
if ( CompChoice == 1 )
{
CompChoice = 1 ;
cout << " Computer Chooses: Rock " << endl;
}
else if ( CompChoice == 2 )
{
CompChoice = 2 ;
cout << " Computer Chooses: Paper " << endl;
}
else if ( CompChoice == 3 )
{
CompChoice = 3 ;
cout << " Computer Chooses: Scissors " << endl;
}
else if ( CompChoice == 4 )
{
CompChoice = 4 ;
cout << " Computer Chooses: Lizard " << endl;
}
else if ( CompChoice == 5 )
{
CompChoice = 5 ;
cout << " Computer Chooses: Spock " << endl;

return CompChoice;
}
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;
return PlayerChoice;
}
if ( ( PlayerChoice == 1 && CompChoice == 1 ) ||
( PlayerChoice == 2 && CompChoice == 2 ) ||
( PlayerChoice == 3 && CompChoice == 3 ) ||
( PlayerChoice == 4 && CompChoice == 4 ) ||
( PlayerChoice == 5 && CompChoice == 5 ) )
{
cout << " TIE! " << endl;
}

else if (( PlayerChoice == 3 && CompChoice == 2 ) ||
( PlayerChoice == 2 && CompChoice == 1 ) ||
( PlayerChoice == 1 && CompChoice == 4 ) ||
( PlayerChoice == 4 && CompChoice == 5 ) ||
( PlayerChoice == 5 && CompChoice == 3 ) ||
( PlayerChoice == 3 && CompChoice == 4 ) ||
( PlayerChoice == 4 && CompChoice == 2 ) ||
( PlayerChoice == 2 && CompChoice == 5 ) ||
( PlayerChoice == 5 && CompChoice == 1 ) ||
( PlayerChoice == 1 && CompChoice == 3 ))
{
cout << " You have WON! " << endl;
}
else if ( ( PlayerChoice == 2 && CompChoice == 3 ) ||
( PlayerChoice == 1 && CompChoice == 2 ) ||
( PlayerChoice == 4 && CompChoice == 1 ) ||
( PlayerChoice == 5 && CompChoice == 4 ) ||
( PlayerChoice == 3 && CompChoice == 5 ) ||
( PlayerChoice == 4 && CompChoice == 3 ) ||
( PlayerChoice == 2 && CompChoice == 4 ) ||
( PlayerChoice == 5 && CompChoice == 2 ) ||
( PlayerChoice == 1 && CompChoice == 5 ) ||
( PlayerChoice == 3 && CompChoice == 1 ) )
{
cout << " You have LOST! " << endl;
}
return 0;
}
Please edit your post to use code tags. See: http://www.cplusplus.com/articles/z13hAqkS/
Then move it to an appropriate forum such as the Beginner's forum (and please bother to at least read the forum descriptions before posting in them.)
A while ago I wrote a rock paper sciccor game. Since the logic is similar you might be able to adapt it.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=13851&lngWId=3
Topic archived. No new replies allowed.