Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. void MarkModel::save(const std::string &filename)
  2. {
  3. std::ofstream file(filename);
  4. if(file.is_open()) {
  5. std::for_each(this->marks.cbegin(), this->marks.cend(),
  6. [&file](double mark) { file << mark << std::endl; } );
  7. file.close();
  8. }
  9. }
  10.  
  11. void MarkModel::load(const std::string &filename)
  12. {
  13. std::ifstream file(filename);
  14. if(file.is_open()) {
  15. std::string line;
  16. double mark;
  17. while( std::getline(file, line) ) {
  18. mark = std::stod(line);
  19. this->addMark(mark);
  20. }
  21. file.close();
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement