int main(void) { int a = 10, b = 20; std::cout << "MAXM1 = " << MAXM(a, b) << std::endl; std::cout << "MAXM2 = " << MAXM(a, b + 0.2) << std::endl; std::cout << "MAXM3 = " << MAXM(a, b++) << std::endl; std::cout << "maxf1 = " << maxf(a, b) << std::endl; // what's the problem with the following line? //std::cout << "maxf = " << maxf((double)a,b+0.2) << std::endl; std::cout << "maxf2 = " << maxf(a + 0.1, b + 0.2) << std::endl; std::cout << "maxf3 = " << maxf(a, b++) << std::endl; std::cout << "a = " << a << ", b = " << b << std::endl; }
int calcPairs(int n, int *a, int *ans, int max, int min) { int i,sum,top,bot; for(i=0;i<n;i+=2) { sum=a[i]+a[i+1]; top=MAXM(a[i],a[i+1]); bot=sum-top; if(max<top) max=top; if(min>bot) min=bot; } (ans[0])=min; (ans[1])=max; return 0 ; }
int depth(tree t){ if(t == NULL) return 0; return 1 + MAXM(depth(t->left), depth(t->right)); }