help please!! card game

hey guys i'm new to c++. i've only done basic oop. so we have to create this card game. can you guys help me create the cards, shuffling and dealing. these are my current codes. the card pack is supposed to have 55 consisting of 1x1s, 2x2s, 3x3s up to 10x10s.

player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 #ifndef PLAYER_H
#define PLAYER_H

#include<string>
using namespace std;

class Player
{
private:
	string playerName;
	int playerPoints;

public:
	Player();
	Player(string name, int points);
	string getName();
	void setName(string name);
	int getPoints();
	void setPoints(int points);
}; 


#endif  


player.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #ifndef PLAYER_H
#define PLAYER_H

#include<string>
using namespace std;

class Player
{
private:
	string playerName;
	int playerPoints;

public:
	Player();
	Player(string name, int points);
	string getName();
	void setName(string name);
	int getPoints();
	void setPoints(int points);
}; 


#endif  


card.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 #ifndef CARD_H
#define CARD_H

#include <string>
using namespace std;

class Cards 
{
public:

private:
	
};

#endif  


card.cpp
1
2
3
  #include<iostream>
#include "Card.h"
using namespace std;


game.cpp
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
94
95
96
97
98
99
100
101
102
103
104
105
106
  #include<iostream>
#include <string>
#include<vector>
#include <fstream>
#include "Player.h"
#include "Card.h"
using namespace std;

void gameMenu();
void gameRules();
void gameStart();
void gamePlay(vector <Player>& );
void printPlayers(vector <Player>&);


int main()
{
	gameMenu();

	return 0;
}

void gameMenu()
{
	cout << "Welcome to Pairs " << endl;
	cout << "Select Menu Option " << endl;
	cout << "1. Game Rules" << endl;
	cout << "2. Play Game " << endl;

	int num;
	cin >> num;

	switch (num)
	{
	case 1:
		gameRules();
		break;
	case 2:
		gameStart();
		break;
	default:
		cout << "invalid " << endl;
	}

	system("pause");
	system("CLS");
}

void gameRules()
{
	cout << "Here are the basic rules of the game" << endl;

	string line;
	fstream rulesFile;
	rulesFile.open("Gamerules.txt");

	if (rulesFile.is_open())
	{
		{
			while (getline(rulesFile, line))
			{
				cout << line << endl;
			}
		}
	}
	rulesFile.close();

	system("pause");
	system("CLS");

	gameMenu();
}

void gameStart() {
	vector <Player> playerclass;
	gamePlay (playerclass);
	printPlayers(playerclass);
}
void gamePlay(vector <Player>& newPlayerclass)
{
	cout << "How many players in the game?" << endl;
	int x;
	cin >> x;

	for (int i = 0; i < x; i++) {
		string n;
		int p=0;
		cout << "Enter name: " << endl;
		cin >> n;

		Player newPlayers(n,p);
		newPlayerclass.push_back(newPlayers);
	}
	
	system("pause");
	system("CLS");

}

void printPlayers(vector <Player>& newPlayerclass) {
	
	unsigned int y = newPlayerclass.size();
	for (unsigned int i = 0; i < y; i++) {
		cout << newPlayerclass[i].getName() << "      " <<newPlayerclass[i].getPoints() << endl;
	}
}
if your goal is to learn OOP, let us know.

typically a deck of cards can do all you need to do using a vector<cards> or often just a vector<ints> if you have a numeric code for what card is what. You can put a little class wrapper around it, but its rarely 'required', just 'nice' sometimes.

with a vector, shuffle is easy, you can use https://www.cplusplus.com/reference/algorithm/shuffle/
and dealing can just be iteration ( [0] is first card dealt, [1] is second card dealt, ...) ... just copy off each card in turn into another vector (a 'hand' or a 'discard pile' or whatever you want to represent).

Of course using vectors to do all the heavy lifting won't teach you a ton of OOP stuff, but it is how one would solve this problem if all options are open.
Topic archived. No new replies allowed.