Advertisement
Rika_Z

bug

Aug 8th, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. using namespace std;
  6. int main()
  7. {
  8.     int IN;
  9.     cout << "Enter new element\n\n";
  10.     cin >> IN;
  11.     vector<int> arr;
  12.     arr.push_back(3);
  13.     arr.push_back(5);
  14.     vector<int>::iterator arrIter;
  15.     int inkr = 0;
  16.     for (arrIter = arr.begin(); arrIter < arr.end(); ++arrIter)
  17.     {
  18.         if (IN < *arrIter)
  19.         {
  20.             ++inkr;
  21.         }
  22.     }
  23.     int inkr1;
  24.     inkr1 = arr.size() - inkr;
  25.     arr.insert(arr.begin() + inkr1, IN);
  26.     cout << "All massive" << endl;
  27.     for (arrIter = arr.begin(); arrIter < arr.end(); ++arrIter)
  28.     {
  29.         cout << *arrIter << endl;
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement