Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double fmax(int r,...)
- {
- int i, max, *f;
- double max1, *fd;
- int n = *(&r + 1);
- max = -999;
- max1 = -999;
- if (r == 0)
- {
- f = &r + 2;
- for (i = 0; i < n; i++)
- {
- if (*(f + i) > max) max = *(f + i);
- }
- return max;
- }
- if (r == 1)
- {
- fd = (double *)(&r + 2);
- for (i = 0; i < n; i++)
- {
- if (*(fd + i) > max1) max1 = *(fd + i);
- }
- return max1;
- }
- return 0;
- }
- int main()
- {
- setlocale(LC_CTYPE, "Rus");
- double r;
- cout << "max в int: " << fmax(0, 14, 4, 5, 15, 2, 6, 5, 3, 43, 3, 2, 6, 8, 5, 1) << '\n';
- cout << "max в double: " << fmax(1, 8, 3.7531, 5.3976, 0.1718, 1.9394, 2.2336, 88.1811, 43.1332, 36.4872) << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement