I'm using Borland C++ on windows and I was wondering how I could save things, I have composed code to save one thing to a txt file but everytime I try to add another thing it just overwrites, I was wondering how I could use vectors to save multiple things to a text file then have the program load them all.
This is the composition so far:
Code:
{
cout <<"your current age is"<< endl;
ifstream in("Agesave.txt");
in >> currentage;
in.close();
cout <<"****"<< currentage <<"****"<< endl;
cout <<"Enter your age"<< endl;
cin >> age;
ofstream save("Agesave.txt");
save << age;
save.close();
return 0;
}
This is excluding the preprocessors and variable declarations, it works fine and saves and loads 1 number how can I make it load multiple numbers.
Any help would be nice, thanks,
Cheers