#include <iostream.h>
#include <string>
#include <fstream>
usingnamespace std;
int main() {
string stringVar; // here's your input variable
getline(cin, stringVar, '\n'); // here's how to get some input
ofstream ofile("C:\\FILE.DOC"); // this opens your file
if (ofile) ofile << stringVar << endl; // this writes your input variable to file
ofile.close(); // this closes your file
}
That's just a basic example of how you can write to a file.