Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. void max_min_el(char *filename)
  2. {
  3. ifstream fin(filename);
  4. if (!fin.is_open()) throw exception("Невозможно открыть файл");
  5. vector<int> v;
  6. int i = 1;
  7. pair<vector<int>::iterator, vector<int>::iterator> p;
  8. while (!fin.eof()) {
  9. v.clear();
  10. fin >> v;
  11. if (v.begin() != v.end())
  12. {
  13. p = minmax_element(v.begin(), v.end());
  14. cout << "Строка №" << i++ << ": ";
  15. cout << "("<<*p.first << " : " << *p.second <<")"<< endl;
  16. }
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement