Let say i have many names in a txt file together with their scores respectively. How do I write those inputs in a new empty txt? I was thinking on using array but what if we don't know what the size of the array is? Or perhaps using eof? Please help
struct scores
{
string name;
int score;
};
// create a struct
scores scoreStruct;
// then create a vector to contain the struct
vector< scores > scoreVector;
// add to the struct - you'll need a loop of some sort, read from file etc.
scoreStruct.name = "Dave";
scoreStruct.score = 1000;
// add to the vector
scoreVector.push_back( scoreStruct );