Advertisement
RobertDeMilo

RB3.2 Введение в модель памяти: куча

Apr 16th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. void fill(istream& is, vector<int>& ints)
  8. {
  9.     int x;
  10.     while (is >> x)
  11.     {
  12.         ints.push_back(x);
  13.     }
  14. }
  15.  
  16. int main()
  17. {
  18.     vector<int> ints1, ints2;
  19.  
  20.     istringstream is1("1 2 3 4");
  21.     fill(is1, ints1);
  22.  
  23.     istringstream is2("5 7");
  24.     fill(is2, ints2);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement