|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
//******************************************************************
// Solitaire program
// This program is a simulation of a card game.
// See text for rules of the game
//******************************************************************
#include bool.h
#include player.h // For Player class
#include <iostream.h>
#include <stdlib.h> // For srand()
int main()
{
Player player; // Card-playing manager
int numberOfShuffles; // Number of shuffles per game
int numberOfGames; // Number of games to play
int gamesPlayed; // Number of games played
int gamesWon; // Number of games won
int seed; // Used with random no. generator
Boolean won; // True if a game has been won
gamesWon = 0;
cout << Enter number of games to play: ;
cin >> numberOfGames;
cout << Enter number of shuffles per game: ;
cin >> numberOfShuffles;
cout << Enter integer seed for random no. generator: ;
cin >> seed;
srand(seed); // Seed the random no. generator
for (gamesPlayed=1; gamesPlayed <= numberOfGames; gamesPlayed++)
{
player.PlayGame(numberOfShuffles, won);
if (won)
gamesWon++;
}
cout << endl;
cout << Number of games played: << numberOfGames << endl;
cout << Number of games won: <gamesWon << endl;
return 0;
} |
|
|
|
|
|