Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <ctime>
- #include <algorithm>
- #include <functional>
- using namespace std;
- struct macierze {
- string name;
- vector<vector<float>> mac;
- };
- void randomize(macierze& x) {
- for (int j = 0; j < 4; j++) {
- int w = rand() % 10;
- x.mac.push_back(vector<float>(5, w));
- }
- }
- void rand_name(macierze& x) {
- char w = rand() % 97 + 26;
- x.name = w;
- }
- void output(macierze x) {
- for (int i = 0; i < x.mac.size(); i++) {
- for (int j = 0; j < x.mac[i].size(); j++) {
- cout << x.mac[i][j] << "\t";
- }
- cout << endl;
- }
- }
- void compare(vector<macierze>& vec_of_mac) {
- }
- int main() {
- srand(time(NULL));
- int i;
- vector<macierze> vec_of_mac;
- for (i = 1; i < 21; i++) {
- macierze i;
- randomize(i);
- output(i);
- vec_of_mac.push_back(i);
- }
- void sort(vec_of_mac[1].name, vec_of_mac[20].name, greater < 'char' >());
- cout << endl;
- for (int j = 1; j < 21; j++) {
- cout << vec_of_mac[j].name << "\t";
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement