#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
ofstream Myfiles("Myfiles.txt");
if (Myfiles.fail())
{
cout << "cant out open file\n";
exit(1);
}
cout << "Let's use the output stream\n";
Myfiles << "Hello world\n";
Myfiles.close();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter