0

Can someone help me in C++ FILE HANDLING

I want to save the data of a phonebook management system in a file and I am unable to do that // PHONEBOOK MANAGEMENT SYSTEM // NOW DOING IT AGAIN , AND GETTING OUT OF THIS SHIT #include<iostream> #include <string.h> #include<fstream> #include<ofstream> ofstream f; f.open("Datain.txt"); using namespace std; class Pms{ private: string name,number; public: void Display(); void Search_data(string naam, string namber); Pms(){ name= "xxx"; number= "0300-1234567"; } Pms(string na, string no){ this->name=na; this->number=no; } void setname(string na){ this->name=na; } void setnumber(string no){ this->number=no; } string getname(){ return name; } string getnumber(){ return number; } void ReadingAllFromFrom() { ifstream f1; f1.open("") } void WriteInFile() { f<<getname()<<endl; f<<getnumber()<<endl; f.close(); } }; void Pms::Display(){ f<<cout<<"The name stored is "<<getname()<<endl; f<<cout<<"The number stored is "<<getnumber()<<endl; f<<cout<<"Your data is saved "<<endl; } void Pms::Search_data(string naam, string namber){ if(name==naam) { cout<<"the name is found "<<endl; } else { cout<<"the name is not found "<<endl; } if(number==namber){ cout<<"the number is found "<<endl; } else{ cout<<"the number is not found"<<endl; } } /* void Pms:: Pecord_stored(){ } */ int main() { string name,number; string naam,namber; int n; Pms obj[100]; cout<<" PHONEBOOK MANAGEMENT SYSTEM"<<endl; cout<<" ---------------------Press 1 to ADD record--------------------------- "<<endl; cout<<" ---------------------Press 2 to SEARCH from record------------------- "<<endl; cout<<" ---------------------Press 3 to SHOW record stored------------------- "<<endl; cout<<" ---------------------Press 4 to MODIFY record-

19th Jun 2020, 12:35 PM
Uzair
Uzair - avatar
2 Answers
+ 2
Uzair Your code being pasted as raw text like this will get truncated due to limits on character count. Please save your code in SoloLearn and attach the code link in the thread Description instead. It's easier to analyse and it won't get truncated that way. Follow the guide below to share the code link 👇 https://www.sololearn.com/post/75089/?ref=app
19th Jun 2020, 1:10 PM
Ipang
0
That problem.is solved ,, can you plz help me in another problem.. I want to make a delete record function which will delete the record of specific ITERATION ... I want to store my name and number of phonebook in a specific ITERATION ,,can you tell.me how can i do that
20th Jun 2020, 8:12 AM
Uzair
Uzair - avatar