Write a complete C++ program to write numbers 1 to 100 (vertically) in a data file NOTES.TXT
#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;
}
Comments
Leave a comment