Answer to Question #212801 in C++ for shahil

Question #212801

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


1
Expert's answer
2021-07-03T04:46:35-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS