pls tell me the error its URGENT!!! plsss

No replies
Anshuk
Offline
Last seen: 4 years 33 weeks ago
Joined: 2015-01-11
bOt Points: 54

#include
#include
#include
#include
#include
#include
class laptop
{long mn;
float ram,hdd;
char det[120];
public:
void stockenter()
{
cout<<"\nEnter model number";
cin>>mn;
cout<<"\n Enter Ram";
cin>>ram;
cout<<"\n Enter HDD";
cin>>hdd;
cout<<"\n enetr details";
gets(det);
}
void stockdisplay()
{
cout<<"\n model number"< cout<<"\n Ram"< cout<<"\n hdd is"< cout<<"\n The details are"< }
long rmn()
{return mn;}
/*void modify();
void del(); void reads(); void append();void writes(); */

void modify()
{int no;laptop l;
ifstream fin;
cout<<"\n Enter a model no to be modified";
cin>>no;
fin.open("laptop.dat", ios::out);
cout<<"\n RAM :" < cout<<"\n HDD:"< cout<<"\n details:"< float rm,hd;
char deta[210];
cout<<"\n New RAM ( Enter'.' to retain old one)";
cin >>rm;
cout<<"\n New HDD (Enter '.' to retain old one)";
cin>>hd;
cout<<"\n New Details(Enter'.' to reatin old one)";
gets(deta);
if(rm== '.') ram=rm;
if(hd=='.') hdd=hd;
if((strcmp (deta,".")==0))
strcpy(det,deta);
}
void writes ()
{ char ans='y';
laptop l;
ofstream fout;
fout.open("laptop.dat",ios::out|ios:binary);
while((ans=='y')||(ans='y'));
{ l.stockcenter();
cout<<"\n continue(y,n)??";
cin>>ans;
fout.write((char*)&l, size of (l));
}
fout.close();
}
void reads()
{laptop l;
ifstream fin;
fin.open("laptop.dat",ios::in|ios::binary);
int m;
cout<<"\nEnter a model number to be searched";
cin>>m;
while
(fin.read((char*)&l,sizeof(l));
{if (l.rmn==m)
{l.stockdislpay();}
else
cout<<"\n no laptop exsist";
}
fin.close();
}
void del()
{char found='f',confirm='n';int n;
ifstream fio("laptop.dat",ios::in);
ofstream fo("temp.dat",ios::out);
cout<<"\nEnter no to be deleted";
cin>>n;
while(!fio.eof())
{fio.read((char*)&l,sizeof(l);
if(l.rmn==n)
{l.stockdislplay();
found='t';
cout<<"\nAre you sure u want to delete";
cin>>confirm;
if(confirm=='n')
fio.write((char*)&l,sizeof(l);
}
fio.write((char*)&l,sizeof(l);
}
if(found=='f')
cout<<"\n Record no found";
fio.close();
fo.close();
remove("laptop.dat");
rename("temp.dat","laptop.dat");
fio.open("laptop.dat",ios::in);
cout<<"\nNow the file contains";
while(!fio.eof())
{fio.read((char*)&l,sizeof(l);
if(fio.eof())
break;
l.stockdisplay();
}
fio.close();
}
void append()
{char b='y';
ofstream.fo("laptop.dat",ios::app|ios::binary);
do()
{l.stockenter();
fo.write((char*)&l,sizeof(l);
cout<<"\n Records added";
cout<<"\n want to enter more records";
cin>>b;
}while(b=='y');
fo.close();
}
main()
{clrscr();
laptop l;
int ch;
writes();
do()
{cout<<"\n What do you want to do?";
cout<<"\n1 Modify";
cout<<"\n2 Delete";
cout<<"\n3 Search";
cout<<"\n4 Add new data";
cout<<"\n5 Exit\n";
cout<<"\n Select choice";
cin>>ch;
switch(ch)
{case 1: l.modify();
break;
case 2 :l.del();
break;
case 3: l.reads();
break;
case 4 :l.append();
break;
case 5 : cout<<"/nBye Thank you: :)";
}
}
getch();
}