6. Please provide step by step and concepts explanation. Thank you !
Here the output of this code is : 12
Step 1:
int fun(int p=2, int q=3);
return p+q
here they have taken the p=2 and q=3 as the argument and they return the p+q
Step: 2
cout<< fun()+fun(1)+fun(1,2) <<endl;
In the main function :
1.firstly the fun()
In this they does not have passed any argument so here we have to take the default argument and the default argument we have is the p=2 and q=3 and the the sum of p and q= 2+3=5.
2. fun(1)
in this they have passed the only one argument and that is 1.so, p=2 will be replaced by the 1. and we do not have the second argument so we have to take the default argument for the second argument in function and that is q=3.
so here p=1 and q=3
so, 1+3=4
3. fun(1,2)
so here they already given as both the argument so do not need to take the any default argument so here p=1 and q=3.
so, 1+2=3
NOTE: when you does not have passed any argument then you have to take the default argument
step-3
cout<< fun()+fun(1)+fun(1,2) <<endl;
fun()=5
fun(1)=4
fun(1.2)=3
by the addition of this three
so, the answer is 5+4+3 =12
so the output of the program is 12.
6. Please provide step by step and concepts explanation. Thank you ! What is the output...
C++ output 6) What is the exact output of the following program? #include <iostream> using namespace stdi void zolo(int &a, int sb) int main int x = 5, y =8; zolo(x,y)i cout << "x " << x << endl ; cout << "y = "" << y << endl ; return o: void zolo(int &a, int &b) int v1 = b + a; ' int v2 = b-a; 3 a=v1;13
Id: 40100885 in c++ output text please thanks! what is the output values printed by the following code? You need to explain step by step how each printed value is calculated. #include <iostream> using namespace std; int m = 0; void SampleMethod (int); int SampleMethod(); void increase(); int main() { int j = 9; SampleMethod(j); cout << j<<endl; return 0; w Y == void SampleMethod(int i) { if (j%2 1) cout << SampleMethod() <<endl; else cout << j << "...
16 Points) Question 3 Write down the outputs of the following program into the provided table include <iostream> using namespace std; void fun I(int a); int fun2(int a, int b); int x-3: int main) int x-1,y 0,z-2; x-fun2(y,z); cout sx fun 1 (z); cout (#xtytz(endl; y-fun2(x,x); cout <exty+zscendl; system("pause"); void fun 1 (int a) int fun2(int a, int b) int static c2; return atx; 16 Points) Question 3 Write down the outputs of the following program into the provided table...
Consider the following C++code snippet and what is the output of this program? # include<iostream> using namespace std; void arraySome (int[), int, int); int main () const int arraysize = 10; int a[arraysize]-1,2,3,4,5, 6,7,8,9,10 cout << "The values in the array are:" << endl; arraySome (a, 0, arraySize) cout<< endl; system ("pause") return 0; void arraySome (int b[], int current, int size) if (current< size) arraySome (b, current+1, size); cout << b[current] <<""; a) Print the array values b) Double...
Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace std; int main ( char greetingl6]- ('H', 'e', T, T, 'o', 0'); cout <<"Greeting message: " cout< greeting << endl return 0;
C++ 1. What is the final output? 2. Why is 2 the ouput for (int)*c? Please explain what happens during the line c = c + *p +1; #include <iostream> using namespace std; int main() { int arr[5] = { 5,2,3,1,4 }; int* p = arr; cout << (int)*p << endl; unsigned char* c = (unsigned char*)arr; p = p + 2; c = c + *p + 1; cout << (int)*p...
Subject: Object Oriented Programming (OOP) Please kindly solve the above two questions as soon as possible would be really grateful to a quick solution. would give a thumbs up. Thank you! Q3: Question # 3 [20] Will the following code compile? If it does not, state the errors. If it does compile, write the output. //Function.cpp #include <iostream> using namespace std; void printData (long i) cout<<"In long print Data "«<i<<endl; } void printData(int i) cout<<"In int printData "<<i<<endl; ) void...
Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph
what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...