今回は手配を更新する関数を追加する。push_backで格納すればいい。
#include<iostream>
#include<vector>
class Player {
public:
Player() {
}
Player(std::string name) {
m_name = name;
}
~Player() {
}
void setPlayerName(std::string name) {
m_name = name;
}
void setPlayerPos(int Pos) {
m_Pos = Pos;
}
void setPlayerKawa(int kawa) {
m_kawa.push_back(kawa);
}
void setPlayerPairs(int Pai) {
m_Pairs.push_back(Pai);
}
void showPlayerPairs(void) {
for (auto itr = m_Pairs.rbegin(); itr != m_Pairs.rend(); itr++) {
std::cout << *itr << std::endl;
}
}
private:
std::string m_name;
std::vector<int> m_kawa;
std::vector<int> m_Pairs;
// int m_Pais[14] = {};
int m_Pos = 0; //1->東 2->南 3->西 4->北
};
int main() {
int yama[136] = {};
Player tonPlayer1;
tonPlayer1.setPlayerPairs(1);
tonPlayer1.setPlayerPairs(2);
tonPlayer1.setPlayerPairs(3);
tonPlayer1.setPlayerPairs(4);
tonPlayer1.setPlayerPairs(5);
tonPlayer1.setPlayerPairs(6);
tonPlayer1.setPlayerPairs(7);
tonPlayer1.setPlayerPairs(8);
tonPlayer1.setPlayerPairs(9);
tonPlayer1.setPlayerPairs(10);
tonPlayer1.setPlayerPairs(11);
tonPlayer1.setPlayerPairs(12);
tonPlayer1.setPlayerPairs(13);
tonPlayer1.showPlayerPairs();
}
コメント