//Read from the file.
using namespace std;
int main()
	//Create a text file.
	ofstream Mywritefile("fileAhmed.txt");
	//Write to the file.
	Mywritefile << "Ahmed abdelmoneim!\nmohamed";
	//Close the file.
	//Create a text string,
	string myText;
	//read from the text
	ifstream Myreadfile("fileAhmed.txt");

	while (getline(Myreadfile, myText))

		cout << myText;
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