Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- vector<int> integers;
- int temp, min, max, index;
- while (cin >> temp)
- {
- integers.push_back(temp);
- }
- sort(integers.begin(), integers.end());
- min = integers[0];
- index = integers.size();
- max = integers[index]; // Тут ошибка, если её закомментировать и потом не использовать 'max', то всё работает идеально.
- cout << "Min int: " << min << endl;
- cout << "Max int: " << max << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment