well..after wasting quite sum couple of hrs i messed uo and hv started to write it again...
here's wat i hv gt till nw...
Code:
#include<iostream.h>
#include<fstream.h>
class bin
{
private:
int a;
public:
bin(int a)
{
cout<<"\n Pointer successfuly created...";
}
bin()
{
cout<<"\n Enter values for the object : ";
cin>>a;
wtf();
}
void wtf();
void rfm();
} s;
void main()
{
bin *p;
int n, i;
cout<<"\n Enter no of objects to be created : ";
cin>>n;
i=n-1;
while(i)
{
i--;
p=new bin;
delete(p);
}
s.rfm();
}
void bin::rfm()
{
int i=0;
ifstream f;
f.open("bin");
f.seekg(0, ios::beg);
f.read((char*)&s, sizeof(s));
cout<<"\n The following data is present : ";
while(f)
{
cout<<"\n Record no."<<++i;
cout<<"\n A = "<<s.a;
f.read((char*)&s, sizeof(s));
}
f.close();
}
void bin::wtf()
{
ofstream f;
f.open("bin", ios::app);
f.write((char*)&s, sizeof(s));
f.close();
}
i yet hv to rewrite the func. sorting...