Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void existnum::display(string name)
- {
- fstream fin;
- fin.open("phonebook.csv",ios::in);
- vector<string>row;
- string line,word,temp;
- int cnt=0;
- while(!fin.eof())
- {
- row.clear();
- getline(fin,line);
- stringstream s(line);
- while(getline(s,word,','))
- {
- row.push_back(word);
- }
- if(name==row[0]){
- cnt=1;
- cout<<row[1]<<endl;
- break;
- }
- }
- fin.close();
- if(cnt==0)
- {
- cout<<"Not found"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment