void saveScoresToFile(std::vector<Score> list) { std::ofstream outfile; outfile.open("highscores.txt"); for ( unsigned int i = 0; i < list.size(); i++ ) { Score temp = list.at(i); outfile<< temp.Getname() << ":" << temp.Getscore() << std::endl; } outfile.close(); }
std::string convertScoresToString(std::vector<Score> list) { std::stringstream out; out<< "High Scores:\n"; if ( list.size() == 0 ) { out<< "No scores recorded"; return out.str(); } for ( unsigned int i = 0; i < list.size(); i++ ) { Score temp = list.at(i); out<< temp.Getname() << " - " << temp.Getscore() << std::endl; } return out.str(); }