logo

Crowdly

#define main1 main /** Question C1 What is output of the program? */ #incl...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

#define main1 main

/** Question C1

What is output of the program?

*/

#include <iostream>

int apply_twice(int v, auto fn){

   return fn(fn(v));

}

int main1(int argc, char** argv){

   int a = 6;

   int b = 16;

   auto op = [a, &b](int x){

      b -= a - x;

      return x + b;

   };

   std::cout << apply_twice(2, op) + op(3);

   return 0;

}

More questions like this

Want instant access to all verified answers on emokymai.vu.lt?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!