This is a very simple thing to do, and can help you if you're ever going to create a hack (If you want to save hack options, or something along those lines).
First, you need to add your includes.
These are the only includes youll need:
- Code:
-
#include <iostream>
#include <fstream>
Next, make sure you tell C++ that you are using namespace std.
add
- Code:
-
using namespace std;
Next, add your main function.
- Code:
-
int main()
{
{
Now add this into your main (ill add comments):
- Code:
-
fstream file;
file.open("test1.txt",ios::out);
file << "This is a good message!";
system("PAUSE");
return 0;
so basicly your source code should be this:
- Code:
-
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream file;
file.open("test1.txt",ios::out);
file << "This is a good message!";
system("PAUSE");
return 0;
}
any questions, post and I should be able to answer them.