What is the output of the following C program include using
What is the output of the following C++ program? #include using namespace std; int manip(int); int manip(int, int); Int manip(int, double); int main() {int x = 2, v = 4, z; double a = 3.1; z = manip(x) + manip(x.y) + manip(y, a); cout
Solution
z = manip(x) + manip(x,y) + manip(y,a);
manip(x) returns 2+(2*2) = 6
manip(x,y) returns (2+4)*2 = 12
manip(y,a) returns 4*3 = 12 since static_cast<int>(3.1) returns 3
So output = z = 6+12+12 = 30
Output: 30 (with newline at end.)
