Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cstddef>
- #include <ctime>
- typedef long long lln;
- int compare(const void *a, const void *b) {
- return (*(int*)a - *(int*)b);
- }
- using namespace std;
- int main()
- {
- srand(time(NULL));
- // vector<int> v1;
- lln n;
- cin >> n;
- int *mas = new int[n];
- for(int i = 0; i < n; ++i) {
- mas[i] = rand() % 100;
- }
- qsort(mas, n, sizeof(int), compare);
- for(int i = 0; i < n; ++i)
- cout << mas[i] << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement