Question #212801

Write a complete C++ program to write numbers 1 to 100 (vertically) in a data file NOTES.TXT


Expert's answer

#include <iostream>
#include <fstream>

using namespace std;


int main () {
	ofstream notesFile;
	//Open the file "NOTES.txt"
	notesFile.open ("NOTES.txt");
	//Write numbers 1 to 100 (vertically) in a data file NOTES.TXT
	for(int i=1;i<=100;i++){
		notesFile <<i<< "\n";
	}
	//Close the file
	notesFile.close();
	//Delay
	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS