Guest User

Untitled

a guest
Oct 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. welcomebits.cpp:30:74: error: could not convert ‘{tmp_fullname, tmp_user_name, tmp_PIN, tmp_balance}’ from ‘<brace-enclosed initializer list>’ to ‘User’
  2. User u={tmp_fullname, tmp_user_name, tmp_PIN, tmp_balance};
  3. ^
  4.  
  5. struct User{
  6. std::string fullname="";
  7. std::string user_name="";
  8. float PIN=0.;
  9. float balance=0.;
  10. };
  11.  
  12.  
  13. void create_user_data(std::vector<User>& uv){
  14.  
  15. std::ifstream reader;
  16. std::string holder="";
  17. char comma=',';
  18. std::string tmp_fullname="";
  19. std::string tmp_user_name="";
  20. float tmp_PIN=0.;
  21. float tmp_balance=0.;
  22.  
  23. reader.open("database.csv");
  24.  
  25. while(std::getline(reader, holder)){
  26. std::istringstream ss(holder);
  27. std::getline(ss, tmp_fullname, ',');
  28. std::getline(ss, tmp_user_name, ',');
  29. ss>>tmp_PIN>>comma;
  30. ss>>tmp_balance;
  31.  
  32. User u={tmp_fullname, tmp_user_name, tmp_PIN, tmp_balance};
  33. uv.push_back(u);
  34. }
  35. }
Add Comment
Please, Sign In to add comment