#include < fstream.h >
#include < conio.h >
class student{
   private:
      int no;
      char name[25];
      float fee;
   public:
      void getdata()
	    {
	 cout << "\n\n Roll Number : ";
	 cin >> no;
	 cout << "\n\n Name : ";
	 cin >> name;
	 cout << "\n\n Fees : ";
	 cin >> fee;
	      }
void putdata()
	    {
	 cout << "\n\n Roll Number : " << no;
	 cout << "\n\n Name : " << name;
	 cout << "\n\n Fees : " << fee;

}
};
void main()
   {
   student s1;
   fstream stdfile;
   clrscr();
   stdfile.open("std.dat",ios::in|ios::binary);
   stdfile.read((char *)&s1,sizeof(s1));
   //s1.putdata();
   while(stdfile)
      {
      s1.putdata();
      stdfile.read((char *)&s1,sizeof(s1));

      }
     stdfile.close();
     getch();
    }
<< GO BACK

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus






Footer1