Game with Stages

Hi I'm a beginner of c++, I would like to ask how to make a class of stages that has easy medium hard, and each stages there has a level 1- 10 and each level has a different number of opponent. I don't know where to start this is my code below.

#ifndef STAGE_H_
#define STAGE_H_
#include <iostream>
#include <ctime>
#include <string>
#include <cstdlib>
using namespace std;

class Stage
{
protected:
int numberOfStage;
int numberOfOpponent;
int howToWin;
double stagePrize;
public:
void setNumOS(int num)//set number of stage
{
numberOfStage = num;
}
void setNumOfO(int opponents)//set number of opponent
{
numberOfOpponent = opponents;
}
void setHWT(int winIt)//set how to win
{
howToWin = winIt;
}
void setPrize(double award)//set Prize each stage
{
stagePrize = award;
}
int generateStage()
{

}
};

class Easy : public Stage
{
public:
};

class Medium : public Stage
{
public:
};

class Hard : public Stage
{
public:
};

#endif
I'm afraid you need to be more specific: what you ask can be realized in many different ways. It doesn't look as a beginner's stuff, by the way...
we are doing a poker game with different stages, the user can choose from easy medium hard, in each level there is a certain stages (1-10), and each stages there is different number of opponent to be more specific
Stage 1 = 1 opponent (1 vs 1)
Stage 2 & 3 = 2
Stage 4 & 5 = 4
Stage 6 & 7 = 5
Stage 8 & 9 = 6
Stage 10 = 7 opponent

and each level of difficulty has a different ways to win
Easy ——— (when user gets $3500 to all the stages)
Medium ——(when user gets $7500 to all the stages)
Hard ———(when user gets $15000 to all the stages)

I'm afraid you need to hard code all those values somewhere, preferably in a separate header, but as a start you could try something very basic like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// we are doing a poker game with different stages, the user can choose from
// easy medium hard, in each level there is a certain stages (1-10), and each
// stages there is different number of opponent to be more specific
// Stage 1 = 1 opponent (1 vs 1)
// Stage 2 & 3 = 2
// Stage 4 & 5 = 4
// Stage 6 & 7 = 5
// Stage 8 & 9 = 6
// Stage 10 = 7 opponent
// and each level of difficulty has a different ways to win
// Easy ——— (when user gets $3500 to all the stages)
// Medium ——(when user gets $7500 to all the stages)
// Hard ———(when user gets $15000 to all the stages)
#ifndef STAGE_H_
#define STAGE_H_

#include <iostream>
#include <string>
#include <vector>

class Stage {
public:
    // -----------------------------------------------------------------------//
    //                     HARD CODED VALUES                                  //
    //          phase correspondance:  1  2  3  4  5  6  7  8  9  10          //
    const std::vector<int> OPPONENTS { 1, 2, 2, 4, 4, 5, 5, 6, 6,  7 };       //
                                                                              //
    const std::vector<std::string> LEVELS { "easy", "medium", "hard" };       //
                                                                              //
    //          level correspondance:  1-EASY  2-MEDIUM   3-HARD              //
    const std::vector<double> PRIZES { 3500.00, 7500.00, 15000.00 };          //
    // -----------------------------------------------------------------------//

    Stage(int level_arg = 0);
    void nextPhase();
    Stage& operator++();                    // prefix
    Stage operator++(int);                  // postfix

    std::string getLevel() const { return LEVELS.at(level); }
    double getPrize() const { return prize; }
    int getPhase() const { return phase + 1; }
    int getOpponents() const { return oppons; }
protected:
    int level;      // easy, medium, hard
    double prize;
    int phase;      // from 0 to 9
    int oppons;     // number of opponents
    friend std::ostream& operator<<(std::ostream& os, const Stage& st)
    {
        os << "This is stage " << st.getPhase()
           << ", you are playing at difficulty " << st.getLevel()
           << ", can win up to $" << st.getPrize()
           << " and are facing " << st.getOpponents() << " opponents.\n";
        return os;
    }
};

Stage::Stage(int level_arg)
    : level { level_arg },                  // add controls!!
      prize { PRIZES.at(level) },
      phase {},
      oppons { OPPONENTS.at(phase) }
    {}

void Stage::nextPhase()
{
    if(phase < OPPONENTS.size() - 1) { ++phase; }
    else                             { return; }
    oppons = OPPONENTS.at(phase);
}

Stage& Stage::operator++() { nextPhase(); return *this; }

Stage Stage::operator++(int)
{
    Stage result(*this);    // currently relying on default copy constructor
    operator++(); // or ++(*this) or nextPhase()
    return result;
}


#endif

int main()
{
    std::cout << "Poker challenge.\n";
    Stage pl_1;
    std::cout << pl_1 << '\n';
    ++pl_1;
    std::cout << pl_1 << '\n';
    Stage pl_2(2);
    std::cout << pl_2 << '\n';
}

Topic archived. No new replies allowed.