Does anyone have a c++ program for a high-low card game??

cud u show me it??:).......how to apply a move,and reset the game/shuffle the cards are what im stuck on!?!?!?!

cud u show me it??:)

Yes I could. But you need to show what you've tried so far (your code/flowchart/pseudocode whatever), no free homework without some effort from you.
Read the link I posted.

Heres sum wit comments.........what i need most is the implementation of the methods of class cHighLow in my highlow.cpp file....

#include "Games.h"


// TODO:  Define class cHighLow here.


class cHighLow : public cGame
{
public:
#define deck_size 52
private:
int size


public:
cHighandLow();
// This method returns the number of players who are required to play the game (in this case 2)
int getNumberOfPlayers();
// This method resets the board to the starting positions
void resetGame();
// This method outputs the state of the game to the screen.
void displayState();
// Reads in a move from the console for the player whose currently supposed to be taking a turn.
// Returns true if successful and returns false if no more moves can be made.
int inputMoveFromConsoleAndApply();
// Apply a move for player_number as long as the space is free, player_number is the correct player to
// take the next turn and player_number has not already taken his turn.  Returns true only if a move is
// made
int applyMove(int player_number, int row, int column);
// This method outputs the result of the game.
void announceResult();
// This method returns whether a game has finished (i.e. returns true if it has
// finished and false otherwise) and if the game is over it sets the winner_number
// to the number of the player who has won or to 0 in the case of a draw.
int gameOver(int& winner_number);
};


and....


#include <iostream>
#include "Games.h"
#include "Players.h"


using namespace std;


// This mainline lets users select a game, select the players for the game
// and then play the game.
int main()
{
cGame* selected_game = cGame::selectGame();
int number_of_players = selected_game->getNumberOfPlayers();
cPlayer** players = new cPlayer*[number_of_players];
for (int player_number=0; player_number < number_of_players; player_number++)
{
players[player_number] = cPlayer::selectPlayer();
}
selected_game->playGame(players);
system("PAUSE");
for (int player_number=0; player_number < number_of_players; player_number++)
{
delete players[player_number];
}
delete[] players;
delete selected_game;
return 0;
}

Edited 3 Years Ago by happygeek: fixed formatting

Do you have a class to represent a card? Does the class have the ability to distinguish when one card is bigger/lower than another?

What are the rules of the game? Is it more like "War" or more like "Rock, Paper, Scissors"?

no class to represent card,

High-Low game:
I. A deck of 52 cards is shuffled
II. The top card is turned over
III. The player must guess if the next card is Higher, Lower or
Equal to the last card turned over.
IV. The next card is turned over
V. If the player is wrong the game is over and the player has
lost
VI. If the player is correct then if the player has made 3
correct guesses the player has won. If not got back to
step III.
Note: The Ace is considered the highest card.

Are you "allowed" to use algorithms from the Standard Template Library (like shuffle()), or do you need to create your own protocols/algorithms/functions?

This article has been dead for over six months. Start a new discussion instead.