Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- void fMaxMin(vector<int*> vec, int* max, int**& min, int** cMax, int& cMin)
- {
- int val_max, val_min, val_cMax, val_cMin;
- // miejsce na Twój kod
- }
- int main()
- {
- auto vec = vector<int>{1, 2, 1, 42, 2, 2, 42, 1, 1, 2, 1, 42};
- auto vecP = vector<int*>();
- for (auto& item : vec)
- {
- vecP.push_back(&item);
- }
- int max, min, cMax, cMin;
- int* ptr_min = &min;
- int** ptr2_min = &ptr_min;
- int* ptr_cMax = &cMax;
- fMaxMin(vecP, &max, ptr2_min, &ptr_cMax, cMin);
- cout << "max: " << max << endl;
- cout << "min: " << min << endl;
- cout << "cMax: " << cMax << endl;
- cout << "cMin: " << cMin << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement