coins/TwelveCoins.cpp
/**
 * @brief: Loads the answer file into a vector of type coin. Each coin will contain two ints. An index 
 *           value which is the first number in the line and than a "weight" which is an integer between
 *           0 and 20.
 * 
 * @return:A vector with one coin for each line in the answer file.
 */
@brief: Loads the answer file into a vector of type coin. Each coin will contain two ints. An index
value which is the first number in the line and than a "weight" which is an integer between
0 and 20.

@return:A vector with one coin for each line in the answer file.
@brief : Loads the answer file into a vector of type coin . Each coin will contain two ints . An index value which is the first number in the line and than a " weight " which is an integer between 0 and 20 . @return : A vector with one coin for each line in the answer file .
std::vector<coin> TwelveCoins::initAnswers()
{
    std::vector<coin> ansVect;
    std::ifstream ansFile(COINSANSWERFILE);
    std::string ansLine;
    while (std::getline(ansFile, ansLine)) {
        if (ansLine[0] == '#') continue;
        if (ansLine[0] == '\n') continue;
        std::stringstream strStream(ansLine);
        int index;
        int weight;
        strStream >> index >> weight;
        if (weight > normalWeight) weight = heavier;
        else if (weight < normalWeight) weight = lighter;
        ansVect.push_back(coin(index,weight));
    }
    ansFile.close();
    return ansVect;
}
std :: vector < coin > TwelveCoins :: initAnswers ( ) { std :: vector < coin > ansVect ; std :: ifstream ansFile ( COINSANSWERFILE ) ; std :: string ansLine ; while ( std :: getline ( ansFile , ansLine ) ) { if ( ansLine [ 0 ] == ' ' ) continue ; if ( ansLine [ 0 ] == ' \n ' ) continue ; std :: stringstream strStream ( ansLine ) ; int index ; int weight ; strStream >> index >> weight ; if ( weight > normalWeight ) weight = heavier ; else if ( weight < normalWeight ) weight = lighter ; ansVect . push_back ( coin ( index , weight ) ) ; } ansFile . close ( ) ; return ansVect ; }
@brief: Loads the answer file into a vector of type coin.
@brief : Loads the answer file into a vector of type coin .