Features:Add and view records, auto-sort, find average score, simple to use.
Requirements: A C++ compiler
The Above Flash movie gives a rough idea of the sorting method
hiscore.h
- Contains the HighScore class
enter_hs.exe
- Program that allows you to enter data into the highscore table
scores.dat
- Binary data file containing the highscores
enter_hs.cpp
- Source for enter_hs.exe
example.cpp
- Shows how to use the HighScore class. Listed below.
#include//The HighScore header file, dont forget this #include"hiscore.h" void main() { //Create our HighScore table HighScore myHighScore; //This function resets the highscore table myHighScore.clearAllRecords(); //This function adds a record. The function does all the sorting //for you. It returns 1 on a successful addition, or 0 if the //record doesn't qualify for the highscores (the score isn't high enough) myHighScore.addRecord("jack",5000); //This function returns the name at the given position cout<<myHighScore.viewRecordName(2)<<endl; //This function returns the score at the given position cout<<myHighScore.viewRecordScore(2)<<endl; //This fuction returns the average score of all the records cout<<myHighScore.findAverageScore()<<endl; }