I'm a newbie at c++ so I'm sure you will find lots of mistakes but I get 3 erroros when compiling this that I can't figure out.
Code:
//******************************************/
// Poker Game
// Play Poker
// Programmer: burn
//
//******************************************/
#include<iostream>
using std::cout;
using std::cin;
using std::ios;
using std::endl;
#include <cstdlib>
#include <ctime>
#include <iomanip>
// ********Function Prototypes ********
int findPair( int[][2] );
int find2Pair( int[][2] );
int findThree( int[][2] );
int findFour( int[][2] );
int findFullHouse( int[][2] );
int findFlush( int[][2]);
int findStraight( int[][2] );
int findStraighFlush( int[][2] );
int findRoyalFlush( int[][2] );
int playHands (int[][2]);
void printResults (int, int);
void shuffle( int [][ 13 ] );
void deal5( const int [][ 13 ], const char *[], const char *[], int[][2] , int );
void initializeDeck( int[][ 13 ] );
int main()
{
int handarray[5][2];
int handarray2[5][2];
int startCard = 1;
const char *suit[ 4 ] =
{ "Hearts", "Diamonds", "Clubs", "Spades" };
const char *face[ 13 ] =
{ "Ace", "Deuce", "Three", "Four",
"Five", "Six", "Seven", "Eight",
"Nine", "Ten", "Jack", "Queen", "King" };
int deck[ 4 ][ 13 ] = { 0 };
int player1Score = 0,
player2Score = 0;
srand( time( 0 ) );
shuffle(deck);
player1Score = playHands ( handarray ); // puts playhands valuie in player1score
player2Score = playHands ( handarray2 ); // Puts playHands value in player2Score
printResults (player1Score, player2Score ); // Prints winner
return 0;
}
// ********Playhands function********
int playHands ( handarray ) {
int score = 0;
score = findRoyalFlush(handarray[][]); // Looks for royal and puts value in score
if(score == 0 ) {
score = findStraightFlush(handarray[][]); // Looks for striaght puts value in score
}
if(score == 0 ) {
score = findFour(handarray[][]); // Looks for four of a kind puts value in score
}
if(score == 0) {
score = findFullHouse(handarray[][]); // Looks for a full house puts value in score
}
if(score == 0) {
score = findFlush(handarray[][]); // Looks for a flush puts value in score
}
if(score == 0) {
score = findStriaght(handarray[][]); // Looks for a striaght puts value in score
}
if(score == 0) {
score = findThree(handarray[][]); // Looks for three of a kind puts value in score
}
if(score == 0) {
score = find2Pair(handarray[][]); // Looks for two pair puts value in score
}
if(score == 0) {
score = findPair(handarray[][]); // Looks for a pairputs value in score
}
return score;
}
// ******* printResults Function ********
void printResults (int player1Score, int player2Score) {
if ( player1Score > player2Score ){
cout << "player1 wins" << endl;
}
if ( player2Score > player1Score ){
cout << "player2 wins" << endl;
}
return 0;
}
errors
Compiling...
poker.cpp
d:\junk\poker.cpp(85) : error C2065: 'handarray' : undeclared identifier
d:\junk\poker.cpp(85) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
d:\junk\poker.cpp(140) : error C2562: 'printResults' : 'void' function returning a value
d:\junk\poker.cpp(41) : see declaration of 'printResults'
Error executing cl.exe.
poker.obj - 3 error(s), 0 warning(s)