Basically I want to be able to create a file name using two variables defined during the program (value unknown to programmer). I can do it using just one variable (i.e (username + ".txt")) , but for some reason using two messes it up.
This is my code.
void User::setTicket(std::string username, int i)
{
std::ofstream fout (username + "Ticket" + i + ".txt");
// Some code
fout.close();
}
int i is essentially a counting digit initialised in a loop in main, so everytime the loop goes round setTicket is called, and hopefully the resulting files would be called
user1Ticket1.txt
user1Ticket2.txt
user1Ticket3.txt
etc