need h.e.l.p. on a program

I'm trying to make a program where you write what you want and then it saves it in a ".txt" file, can someone please write the code or at least help me please?
(I'm still a beginner with c++)
What do you have so far. Have you read through http://www.cplusplus.com/doc/tutorial/files/ yet?
I can't figure it out, this program here should save in .txt what it's written in the "myfile <<..."
but how do i do it if I want to enter wat to save?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile ("NotepadExample.txt");
  if (myfile.is_open())
  {
    myfile << "This is a text example, this text will be saved in .txt format."<<testo<<endl;
    myfile.close();
  }
  else cout << "Unable to open file";
  return 0;
}
oops made an error, don't mind the "<<testo" on line 9.
Topic archived. No new replies allowed.