Program is to store marks and name, roll no in a file:
class stud
{
int rno;
char name[20];
int m1,m2,m3;
public:
void accept()
{
cout<<"enter the roll no. : ";
cin>>rno;
cout<<"enter the name : ";
gets(name);
cout<<"enter marks of 3 subjects : ";
cin>>m1>>m2>>m3;
}
};
void main()
{
clrscr();
stud s;
s.accept();
ofstream a ("stud.dat" , ios::binary | ios::app);
a.write ( (char *) &s , sizeof(s) );
a.close();
}