cout<<"menu:"; cout<<" 1.create a file and write objects onto it"; cout<<" 2.read objects on the file and display"; cout<<" 3.append data to the file"; cout<<" 4.search for an icode"; cout<<" 5. delete record"; cout<<" 6. Modify"; cout<<" 7. Insert"; cout<<" 8.Copy"; cout<<" 9.exit"; cout<<"enter choice"; cin>>choice; switch(choice) { case 1: A.create(); break; case 2: A.readobj();break; case 3: A.appdata();break; case 4: A.search();break; case 5: A.Del();break; case 6: A.Modify();break; case 7: A.Insert();break; case 8: A.Copy();break; case 9: exit(0); 4
default: cout<<"wrong choice entered"; } }while(ans=='y'); cout<<"do u wish to continue y /n ? "; cin>>ans; } void item::create() { clrscr(); char ch= 'y'; ofstream fout; fout.open("item.dat",ios::binary|ios::out); if(!fout) { cout<<"error opening file"; exit(0); } do { item i; i.getdata(); fout.write((char*)&i,sizeof(i)); cout<<"do u wish to add more y/n? "; cin >> ch; 5