My problem is that I can not manege to create a program that can output text to the .txt file. I don't want a static text, but a text that I can change every time I use the program (write it in myself before it gets saved to the .txt file.)
So far I made this, but I know that the x is not the right way to go, but I have no idea how to make it work? Please help me Im a complete noob at this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <fstream>
usingnamespace std;
int main () {
ofstream myfile;
myfile.open ("teksts.txt", ios::app);
cin >> x;
myfile << x;
cout<< "The file has been updated!";
return 0;
getchar();
getchar();
}