Maruf_Hasan

display of project

Jun 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. void existnum::display(string name)
  2. {
  3. fstream fin;
  4. fin.open("phonebook.csv",ios::in);
  5. vector<string>row;
  6. string line,word,temp;
  7. int cnt=0;
  8. while(!fin.eof())
  9. {
  10. row.clear();
  11. getline(fin,line);
  12. stringstream s(line);
  13. while(getline(s,word,','))
  14. {
  15. row.push_back(word);
  16. }
  17. if(name==row[0]){
  18. cnt=1;
  19. cout<<row[1]<<endl;
  20. break;
  21. }
  22. }
  23. fin.close();
  24. if(cnt==0)
  25. {
  26. cout<<"Not found"<<endl;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment