/*the fstream library allows us to work with files.
To use The fstream library,include both the standard:
<iostream>AND the <fstream> header file:
there are three classes included in the fstream Library.
Which are used to Create,Write or read file:
ofstream:Create and Writes to files.
ifstream:Reads from files.
fstream:A Combination of ofstream and ifstream:creates,reads,and writeto files.*/
//Create and Write To File.
using namespace std;
int main()
	//Create and open a text file.
	ofstream Myahmedfile("ahmedfile.txt");
	//Write to the file.
	Myahmedfile << "Hello Ahmed Abdelmoneim";
	//Close the file.
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