need help making a leaderboard(high score table) in c++that has a class called LeaderBoard with member functions addScore, store, print, and load.
this is what i have so far #include<iostream> #include<string> #include<fstream> using namespace std; class LeaderBoard { public: void setaddScore(string, int); void getaddScore(string, int); void addScore(string, int) }; void LeaderBoard::setaddScore(string, int) { return name, score; } void LeaderBoard::getaddScore(string, int) { string name[20]=n; int score[20]=s; } void LeaderBoard:: addScore(string n, int s) { count++; names[count]; score[count]; } int main() { /*string n; int s; LeaderBoard x; x.addScore("jas", 469);*/ return 0; }
First, you need to write your constructor and destructer for the class. In addScore, you're not doing anything with names and score (which aren't declared).
Join our real-time social learning platform and learn together with your friends!