diff --git a/ChallengeLeaguePointSolver/ChallengeLeaguePointSolver.cpp b/ChallengeLeaguePointSolver/ChallengeLeaguePointSolver.cpp index 29c1be1..71de8e2 100644 --- a/ChallengeLeaguePointSolver/ChallengeLeaguePointSolver.cpp +++ b/ChallengeLeaguePointSolver/ChallengeLeaguePointSolver.cpp @@ -1,5 +1,73 @@ #include +#include +#include +#include + +std::string slurp(std::ifstream& in) { + std::ostringstream sstr; + sstr << in.rdbuf(); + return sstr.str(); +} + +struct ScoreData{ + int difficulty; + std::string song; + int totalEX; + int ex1,ex2,ex3; + std::string str()const{ + return "["+std::to_string(difficulty)+"] "+song+": "+std::to_string(totalEX)+" total, "+" EX1: "+std::to_string(ex1)+" EX2: "+std::to_string(ex2)+" EX3: "+std::to_string(ex3); + } + friend std::ostream&operator<<(std::ostream&os,const ScoreData&data){ + os<dataA,dataB; + std::ifstream file("team.csv"); + std::string line; + //First two lines are garbage data. + std::getline(file,line); + std::getline(file,line); + for(int i=0;i<12;i++){ + std::getline(file,line); + int marker=0; + dataA.emplace_back(ScoreData{ + stoi(GetNext(marker,line)), + GetNext(marker,line), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line))} + ); + } + //Two more lines of garbage data. + std::getline(file,line); + std::getline(file,line); + for(int i=0;i<12;i++){ + std::getline(file,line); + int marker=0; + dataB.emplace_back(ScoreData{ + stoi(GetNext(marker,line)), + GetNext(marker,line), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line)), + stoi(GetNext(marker,line))} + ); + } + + for(auto&list:{dataA,dataB}){ + for(auto&dat:list){ + std::cout<