#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main ()
{
string name;
string location;
string age;
// Create/overwrite my output file
ofstream myfile ("example2.txt",ios::out|ios::trunc);
if (myfile) // (only continue if file is opened ok)
{
// Instructions
system("color 1B");
system("title Project Delta");
cout << "Please will you answer these few quesions.\n"
<< "If you wish to quit just leave it empty and click ENTER.\n\n";
// First question
cout<<"What's your name?\n";
getline( cin, name );
system("CLS");
cout << "Please will you answer these few quesions.\n" << "If you wish to quit just leave it empty and click ENTER.\n\n";
cout << "Where do you come from?\n";
getline( cin, location);
system("CLS");
cout << "Please will you answer these few quesions.\n" << "If you wish to quit just leave it empty and click ENTER.\n\n";
cout << "How old are you?\n";
getline( cin, age);
myfile << name << " from " << location << " aged " << age << "."; // write this in myfile(example.txt)
myfile.close();
}
else cout << "Unable to open file";
system("PAUSE");
return 0;
}
I want to make it so it stores it all as one file because at the current moment it deletes anything thats saved in there once it starts up again.
Also if its possible how would i make it have a windows frame around it?