C++ find output programs
- C++ Operators | Find output programs | Set 1
- C++ Operators | Find output programs | Set 2
- C++ const Keyword | Find output programs | Set 1
- C++ const Keyword | Find output programs | Set 2
- C++ Manipulators | Find output programs | Set 1
- C++ Manipulators | Find output programs | Set 2
- C++ Reference Variable | Find output programs | Set 1
- C++ Reference Variable | Find output programs | Set 2
- C++ Conditional Statements | Find output programs | Set 1
- C++ Conditional Statements | Find output programs | Set 2
- C++ Switch Statements | Find output programs | Set 1
- C++ Switch Statements | Find output programs | Set 2
- C++ goto Statement | Find output programs | Set 1
- C++ goto Statement | Find output programs | Set 2
- C++ goto Statement | Find output programs | Set 2
- C++ Looping | Find output programs | Set 1
- C++ Looping | Find output programs | Set 2
- C++ Looping | Find output programs | Set 3
- C++ Looping | Find output programs | Set 4
- C++ Looping | Find output programs | Set 5
- C++ Default Argument | Find output programs | Set 1
- C++ Default Argument | Find output programs | Set 2
- C++ Arrays | Find output programs | Set 1
- C++ Arrays | Find output programs | Set 2
- C++ Arrays | Find output programs | Set 3
- C++ Arrays | Find output programs | Set 4
- C++ Arrays | Find output programs | Set 5
- C++ Strings | Find output programs | Set 1
- C++ Strings | Find output programs | Set 2
- C++ Strings | Find output programs | Set 3
- C++ Strings | Find output programs | Set 4
- C++ Strings | Find output programs | Set 5
- C++ Class and Objects | Find output programs | Set 1
- C++ Class and Objects | Find output programs | Set 2
- C++ Class and Objects | Find output programs | Set 3
- C++ Class and Objects | Find output programs | Set 4
- C++ Class and Objects | Find output programs | Set 5
- C++ Constructor and Destructor | Find output programs | Set 1
- C++ Constructor and Destructor | Find output programs | Set 2
- C++ Constructor and Destructor | Find output programs | Set 3
- C++ Constructor and Destructor | Find output programs | Set 4
- C++ Constructor and Destructor | Find output programs | Set 5
- C++ this Pointer | Find output programs | Set 1
- C++ this Pointer | Find output programs | Set 2
- C++ this Pointer | Find output programs | Set 3
- C++ Structures | Find output programs | Set 1
- C++ Structures | Find output programs | Set 2
- C++ Structures | Find output programs | Set 3
- C++ Structures | Find output programs | Set 4
- C++ Structures | Find output programs | Set 5
- C++ Friend Function | Find output programs | Set 1
- C++ Friend Function | Find output programs | Set 2
- C++ Function Overloading | Find output programs | Set 1
- C++ Function Overloading | Find output programs | Set 2
- C++ Function Overloading | Find output programs | Set 2
- C++ Function Overloading | Find output programs | Set 3
- C++ Static Variables and Functions | Find output programs | Set 1
- C++ Static Variables and Functions | Find output programs | Set 2
- C++ Static Variables and Functions | Find output programs | Set 3
- C++ Static Variables and Functions | Find output programs | Set 4
- C++ Static Variables and Functions | Find output programs | Set 5
- C++ Operator Overloading | Find output programs | Set 1
- C++ Operator Overloading | Find output programs | Set 2
- C++ Operator Overloading | Find output programs | Set 3
- C++ Operator Overloading | Find output programs | Set 4
- C++ Operator Overloading | Find output programs | Set 5
- C++ Enumeration | Find output programs
- C++ Inheritance | Find output programs | Set 1
- C++ Inheritance | Find output programs | Set 2
- C++ Inheritance | Find output programs | Set 3
- C++ Inheritance | Find output programs | Set 4
- C++ Inheritance | Find output programs | Set 5
- C++ Exceptional Handling | Find output programs | Set 1
- C++ Exceptional Handling | Find output programs | Set 2
- C++ Exceptional Handling | Find output programs | Set 3
- C++ Virtual Functions | Find output programs | Set 1
- C++ Virtual Functions | Find output programs | Set 2
- C++ Virtual Functions | Find output programs | Set 3
- C++ Templates | Find output programs | Set 1
- C++ Templates | Find output programs | Set 2
- C++ Preprocessor | Find output programs | Set 1
- C++ Preprocessor | Find output programs | Set 2
- C++ Preprocessor | Find output programs | Set 3
- C++ Signal Handling | Find output programs | Set 1
- C++ Namespace | Find output programs | Set 1
- C++ Namespace | Find output programs | Set 2
- C++ Dynamic Memory Allocation | Find output programs | Set 1
- C++ Dynamic Memory Allocation | Find output programs | Set 2
- C++ Dynamic Memory Allocation | Find output programs | Set 3
Answer Program 1:
Output:
Explanation:
Here we defined a macro ADD() to add the number by itself. In the main() function, we declared 3 local variables X, Y, and Res that initialized with 10, 20, and 0 respectively.
Now evaluate the expression.
Res = ADD(X)*ADD(Y); Res = ADD(10)*ADD(20); Res = 10+10*20+20; // '*' has high priority then '+' then '*' will calculate before '+' Res = 10+200+20; Res = 230;
Then 230 will print on the console screen.
Answer Program 2:
Output:
Explanation:
In the above program, we defined a macro S, then "sum" is substituted at the place of the function name. Then the actual name of the function will be the sum.
In the main() function, here we declared three local variables X, Y, and Z initialized with 10,20, and 30 respectively.
Now we call function sum() and pass argument X and Y then the function will return the sum of X and Y that is 30, which is stored in Z, and then we print Z using cout.
Answer Program 3:
Output:
Explanation:
In the above program, we define a preprocessor macro M for main(). Then we use M in-place of main() function. The M will be substituted by the main(). In the main() function we declared three local variables X, Y, and Z.
X, Y, and Z are initialized with 10, 20, and 0 respectively. Here, we store the sum of X and Y into variable Z. Then final value Z will be 30 and it will be printed on the console screen.
Answer Program 4:
Output:
Explanation:
In the above program, we define a preprocessor macro M for main(). Then we use M in-place of main() function. The M will be substituted by int main(). In the main() function we declared three local variables X, Y, and Z.
X, Y, and Z are initialized with 10, 20, and 0 respectively. Here, we store the sum of X and Y into variable Z. Then final value Z will be 30 and it will be printed on the console screen.
Answer Program 5:
Output:
Explanation:
In the above program, we define a preprocessor macro M for main(). Then we use M in-place of the complete definition of the main() function.
In the main() function we print 20 using cout.
need an explanation for this answer? contact us directly to get an explanation for this answer