#include #include #include #include class data { char *name,*location; public: void menu(),menu1(),dataip(); void srchname(),srchlocn(); } main() { data obj; int choice; do { obj.menu(); cout<<"Enter ur Choice:\n"; cin>>choice; switch(choice) { case 1:obj.dataip(); ofstream file; file.open("dbase.txt",ios::out); if(file.fail()) { cout<<"\nCannot Open File\n"; /* exit();*/break; } file.write((char*) &obj,sizeof(obj)); // file.write((char*) &obj.location,sizeof(obj.location)); file.close(); break; case 2:obj.menu1(); cout<<"Enter ur Choice\n"; cin>>choice; if(choice==1) obj.srchname(); else if(choice==2) obj.srchlocn(); else cout<<"\n\nINVALID OPTION\n\n"; break; default:cout<<"\n\nINVALID OPTION\n\n"; } cout<<"\nContinue(1/0)?\n"; cin>>choice; }while(choice!=0); } void data::menu() { cout<<"1.Enter location info about a software into DataBase\n"; cout<<"2.Search for location of a software from DataBase on CDs\n\n"; } void data::menu1() { cout<<"\n1.Search By Software name\n"; cout<<"2.Search By Location\n\n"; } void data::dataip() { cout<<"\nEnter Name of the software\n"; cin>>name; cout<<"\nEnter the location info of the above software\n"; cin>>location; } void data::srchname() { ifstream p; data obj; char *temp; //p.open("dbase.txt",ios::in||ios::out); cout<<"\n\nEnter the name of software\n:"; cin>>temp; p.open("dbase.txt",ios::in); if(p.fail()) { cout<<"\nCannot Open File\n"; /* exit(); */ } while(!p.eof()) { p.read((char*) &obj,sizeof(obj)); if(strcmp(obj.name,temp)) { // p.read((char*) location,sizeof(location)); cout<<"Name:\t"<>temp; p.open("dbase.txt",ios::in); if(p.fail()) { cout<<"\nCannot Open File\n"; /* exit();*/ } while(!p.eof()) { p.read((char*) &obj,sizeof(obj)); if(strcmp(obj.location,temp)) { // p.read((char*) &name,sizeof(name)); cout<<"Name:\t"<