Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- void read_record()
- {
- fstream fin;
- fin.open("new1.csv",ios::in);
- {
- cout<<"E"<<endl;
- string name;
- cin>>name;
- 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, ','))
- {
- //cout<<word<<endl;
- row.push_back(word);
- }
- if(name==row[0])
- cout<<row[1]<<endl;
- // for(int i=0;i<row.size();i++)
- // cout<<row[i]<<" ";
- // cout<<endl;
- }
- }
- fin.close();
- }
- int main()
- {
- read_record();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment