Saturday, February 26, 2011

Files


#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<iomanip.h>

void main()
{
fstream ob;

ob.open("stud1.dat",ios::out|ios::binary);

int rollno,mark,entry;

clrscr();

cout<<"\n\n\n\n\t\t\tEnter the serial no[0 to exit]:";
cin>>entry;

 while(entry!=0)
 {
 cout<<endl<<"\n\n\t\tEnter the stud no: ";
 cin>>rollno;

 cout<<"\n\n\t\tEnter the mark: ";
 cin>>mark;

 cout<<endl;

 ob<<setw(0)<<rollno<<setw(10) <<mark<<endl;

 cout<<"\n\n\n\t\t\tEnter serial no[0 to exit]";
 cin>>entry;

 }

ob.close();

getch();

}

No comments:

Post a Comment