Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> // Для консольного ввода вывода
- #include <vector> //Для использования векторов (динамических массивов)
- #include "windows.h"
- #include <ctime> //Таймер для генератора случайных чисел
- #include <algorithm>
- #include <set>
- using namespace std; // Пространство имён по умолчанию
- bool MyFind(string text, char templ)
- {
- int i = 0;
- for (; i < text.length(); i++)
- {
- if (text[i] == templ)
- {
- return true;
- }
- }
- return false;
- }
- int MyInt(int& y)
- {
- return y = y*y;
- }
- void MySort(vector<int>& h)
- {
- int i = 0, min = 0, numb, j;
- for (i = 0; i < h.size(); i++)
- {
- for (j = i + 1; j < h.size(); j++)
- {
- if (h[i] < h[j])
- {
- //swap(h[i], h[j]);
- min = h[j];
- h[j] = h[i];
- h[i] = min;
- }
- }
- }
- }
- int main()
- {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- srand(time(0)); //Начинаем генерировать последовательность случайных чисел, в зависимости от текущего времени
- /*string s, q = "";
- while (cin >> s)
- {
- q = q + s;
- if (MyFind(q, 'p')) cout << "yes\n";
- else cout << "no\n";
- }*/
- int i = 5,j;
- j = MyInt(i);
- //cout << i;
- vector <int> v;
- int min = 0, numb;
- while (cin >> numb)
- {
- v.push_back(numb);
- }
- MySort(v);
- for (auto it : v) cout << it << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement