我不知道为什么这个程序不打印任何东西,甚至是第一个打印语句。可能是什么问题?
它使用g++ filename.cpp
.
#include "deck.h"
#include "hand.h"
#include <vector>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
cout << "not even this";
vector<Hand> hands;
Deck deck;
int players;
int seed;
int sizeOfHand = 5;
int i;
vector<Hand>::iterator itr;
cout << "Enter seed: ";
cin >> seed;
srand(unsigned(seed));
cout << "Enter number of players: ";
cin >> players;
for (i = 0; i < players; i++) {
hands.push_back(Hand());
}
deck.Shuffle();
for (i = 0; i < sizeOfHand; i++) {
vector<Card> cards = deck.Deal(players);
for (itr = hands.begin(); itr < hands.end(); itr++) {
cout << "1";
itr->add(*cards.begin());
cards.erase(cards.begin());
}
}
for (itr = hands.begin(), i=1; itr < hands.end(); itr++, i++) {
cout << "Player " + i;
itr->showHand();
}
}