c++ 错误:vector不指定类型

我的最终项目(扑克和黑色杰克模拟)中有很多错误。我正在使用一个向量来实现blackJack类中的“手”,而且我使用的是在另一个类中声明的结构化数据类型,它是公开继承的。我担心的错误是我使用的编译器告诉我,我没有在向量中声明一个类型。

blackJack头文件:

 #ifndef BLACKJACK_H
 #define BLACKJACK_H
 #include <vector>
 #include "card.h"

 class blackJack: public cards
 {
 private:
    vector <Acard> playerHand;
    vector <Acard> dealerHand;

 public:
    blackJack();
    void dealHands();
    void hitOrStay();
    void dealerHit();
    int handleReward(int);
    void printHands();
 };
 #endif 

卡头文件(这是黑杰克继承的类):

 #ifndef CARD_H
 #define CARD_H

 const char club[] = "\xe2\x99\xa3";
 const char heart[] = "\xe2\x99\xa5";
 const char spade[] = "\xe2\x99\xa0";
 const char diamond[] = "\xe2\x99\xa6";
 //structured data to hold card information
 //including:
 // a number, representing Ace-King (aces low)
 //a character, representing the card's suit
 struct Acard
 {
   int number;
   char pic[4];
 };



 // a class to hold information regarding a deck of cards
 //including:
 //An array of 52 Acard datatypes, representing our Deck
 //an index to the next card in the array
 //a constructor initializing the array indices to Ace-king in each suit
 //a function using random numbers to shuffle our deck of cards
 //13 void functions to print each card
 class cards
 {
  private:
    Acard Deck[52];
    int NextCard;
  public:
    cards();
    Acard getCard();
    void shuffleDeck();
    void cardAce(char[]);
    void cardTwo(char[]);
    void cardThree(char[]);
    void cardFour(char[]);
    void cardFive(char[]);
    void cardSix(char[]);
    void cardSeven(char[]);
    void cardEight(char[]);
    void cardNine(char[]);
    void cardTen(char[]);
    void cardJack(char[]);
    void cardQueen(char[]);
    void cardKing(char[]);

 };

 #endif
你忘了向矢量类名添加std :: namespace前缀。
http://stackoverflow.com/questions/8403468/error-vector-does-not-name-a-type

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:c++ 错误:vector不指定类型