C++ Program To Write Numbers 1 to 100 in a data file

How to write a C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programming.


C++ Program to write numbers 1 to 100 in a data file notes.txt in C++ Programmin.
C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programmin.


Solution:
//Program to write numbers one to hundred in a data file notes.txt
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
clrscr();

ofstream ofile("notes.txt");
for(int i=1;i<=100;i++)
ofile<<i<<" ";
ofile.close();

char a;
ifstream ifile("notes.txt");
while(!ifile.eof())
{
ifile.get(a);
cout<<a;
}
getch();
}

This C++ Program to write numbers one to hundred in a data file notes.txt in C++ Programming.


Learn More :