sahajjain01

Program to write nos. 1 to 100 in a file.

Jul 20th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. //Program to write numbers one to hundred in a data file notes.txt
  2. #include<iostream.h>
  3. #include<conio.h>
  4. #include<fstream.h>
  5. void main()
  6. {
  7.     clrscr();
  8.  
  9.     ofstream ofile("notes.txt");
  10.     for(int i=1;i<=100;i++)
  11.     ofile<<i<<" ";
  12.     ofile.close();
  13.  
  14.     char a;
  15.     ifstream ifile("notes.txt");
  16.     while(!ifile.eof())
  17.     {
  18.         ifile.get(a);
  19.         cout<<a;
  20.     }
  21.     getch();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment