Create a program in C++ language Create a LeaderEntry Header file. In this file we will create LeaderEntry class: public LeaderEntry(); LeaderEntry(string playernameIn, int pointsIn, string datetimeIn); ~LeaderEntry(); private string playername; int gamepoints; string dategame; The first step is to create a Header file and LeaderEntry class as defined above. In main create a LeaderEntry object in your main. with sample data. Retrieve the entry and then display it at the beginning of the game. Now store LeaderEntry into a Vector and retrieve. Example vector leaderboardtopten; LeaderEntry *s1 = new LeaderEntry; LeaderEntry *s1 = new LeaderEntry; LeaderEntry *s1 = new LeaderEntry; s1->gamepoints = 7000; LeaderEntry *s2 = new Site; s2->gamepoints = 9000; leaderboardtopten.push_back(*s1); // leaderboardtopten.push_back(*s2); ... // Getting object out of Vector vector::iterator it; for (it = leaderboardtopten.begin(); it != leaderboardtopten.end(); ++it) { cout << it->gamepoints; } 5. Have the entry display at the front of the game i.e. Output Screen at this time. 6. Add the remainder 9 sample Leader Entries into the game.
Create a
Create a LeaderEntry Header file.
In this file we will create LeaderEntry class:
public
LeaderEntry();
LeaderEntry(string playernameIn, int pointsIn, string datetimeIn);
~LeaderEntry();
private
string playername;
int gamepoints;
string dategame;
The first step is to create a Header file and LeaderEntry class as defined above.
- In main create a LeaderEntry object in your main. with sample data.
- Retrieve the entry and then display it at the beginning of the game.
- Now store LeaderEntry into a
Vector and retrieve.
Example
vector<LeaderEntry> leaderboardtopten;
LeaderEntry *s1 = new LeaderEntry;
LeaderEntry *s1 = new LeaderEntry;
LeaderEntry *s1 = new LeaderEntry;
s1->gamepoints = 7000;
LeaderEntry *s2 = new Site;
s2->gamepoints = 9000;
leaderboardtopten.push_back(*s1);
// leaderboardtopten.push_back(*s2);
...
// Getting object out of Vector
vector<LeaderEntry>::iterator it;
for (it = leaderboardtopten.begin(); it != leaderboardtopten.end(); ++it) {
cout << it->gamepoints;
}
5. Have the entry display at the front of the game i.e. Output Screen at this time.
6. Add the remainder 9 sample Leader Entries into the game.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images