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-