Just need some assistance.

Heres the code for my Servey Programme. It records the answers that you say in a .txt file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <fstream>
#include <string>
using namespace 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?
Topic archived. No new replies allowed.