hopingsteam

Marfa pentru El Chapo

Aug 28th, 2019
178
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include    <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int maxim(int nr_arg, ...)
  6. {
  7.     //va = variable arguments
  8.     va_list ap;
  9.     va_start(ap, nr_arg);
  10.     int max = va_arg(ap, int);
  11.     for(int i = 2; i <= nr_arg; i++) {
  12.         int a = va_arg(ap, int);
  13.         if(a > max) max = a;
  14.     }
  15.     va_end(ap);
  16.     return max;
  17. }
  18.  
  19. int main()
  20. {
  21.     cout << maxim(5, 1, 2, 9, 4, 5);
  22.     return 0;
  23. }
RAW Paste Data