Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iomanip>
- #include <iostream>
- #include <random>
- #include <vector>
- using namespace std;
- int main() {
- const int DATA_NO = 100;
- vector<int> v;
- random_device rdev;
- mt19937 gen(rdev());
- uniform_int_distribution<> dist(0, 999);
- for (int i = 0; i < DATA_NO; i++)
- v.push_back(dist(gen));
- for (int i = 0; i < DATA_NO; i++) {
- if (i % 10 == 0) cout << endl;
- cout << setw(4) << v[i];
- }
- cout << endl;
- sort(v.begin(), v.end());
- for (int i = 0; i < DATA_NO; i++) {
- if (i % 10 == 0) cout << endl;
- cout << setw(4) << v[i];
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement