1st question answer
in simple steps
program and output
2nd question answer
in the context of detailed explanation given more data..
if you have any problem in the means of understanding please comment..
all the best... hope u enjoy... thank u
Part #2 Trace and show your steps and the output of the following code segment const...
Consider the following code segment, what is the output? //you please explain your answer with all the steps?? int j, k; for (k=0;k<10; k++) { for (j=0; j<5;j++) cout << "*"; } cout << endl;
howthe output of the following 4 program segments (a) const int SIZE=8; int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8}; int index; index=0; res = values[index]; for (int j=1; j<SIZE; j++) { if (values[j] > res) { res = values[j]; index = j; cout << index << res << endl; } } cout <<...
Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int main0 // define two integers int x-3; int y = 4; //print out a message telling which is bigger if (x >y) i cout << "x is bigger than y" << endl: else cout << "x is smaller than y" << endl; return 0; Example (5) Write a C++ program that takes from the user a number in SR (Saudi Riyal) then the program...
a) Hand-trace the following program and determine and write down what is the output of the code. b) Run the code and compare the program output to your hand-traced result obtained from part (a). #include <iostream> #include <iomanip> using namespace std; void f(); int x = 5; int main() { cout << "x = " << x << endl; int x = 6; cout << "x = " << x << endl; { int...
points): Show the output of the code below as it would appear on the monitor. int main cout <<" <<endl: int wildcat 2: while (wildcat > 5) cout << wildcat <<endl; wildcat++ cout <K*<< endl; int jayhavk 5i do cout << jayhawk <s endl: while (jayhawk0) cout <<*" << endl; int wolverine l: while (wolverine 0 &&wolverine < 10) cout << wolverine <<endl: wolverine2: cout <<" <<endl: for (int zag-4; zag>0; zag_) cout <<****" << endl; for (int i-10; i<-30;...
18 C++ 1. What is the output of the following program segment? int y-22: while ((y 3) != 0) cout << y<< "": y=y-2; The output is 2. Suppose that the input is 100, 20,-8, 50, 20. What is the output of the following C++ code? int sum0 int num: int j cin >> num: if (num < 0) continue зит зит + num; cout<< sum << endl; The output is
IV. Function Tracing (20 points) Trace the following program. Show llof your work and the ound he output in the work including labeled boxes for user-defined functions, calculations, and the output in designated spaces. You should draw a box for each variable and show value updates d the output, Show all of your #include <iostream» using namespace std; void mickey (int sa, int b, int &c) void minnie(int u, int &v, int w); void pluto (int m, int n, int...
Trace the following program and display the exact outpust #incl udeci ostream» using namespace std const int siz-10 int ffx(Float ati,Float b(l, int s): bool ifp(int n) int mainO loat arysiz]-(6,19,5,3,2,17,40,90,19,80) float ary2tsiz)-to int i,x x-ffx(aryl,ary2, ,siz): cout<<"n The values are: for(1-0:1<" ; it) ary2[i] ; cout<<" coutくくendl ; return 0; oerio int ffx(float all,float bll, int S) int i,p-0; for(i 0: i<s ; i++){ )// end for LD++]=a[i]; return p; if(ifp(ali])) bool ifp(int n)l bool ans-true for (i=2:ic, itt)...
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...
What is the output from each of the following segments of C++ code? Record the output after the “Answer” prompt at the end of each program fragment. Assume all variables have been suitably declared. (Each problem is worth 3 points.) 1. for (int j = 25; j > 16; j -= 3) cout << setw(5) << j; Answer: 2. int sum = 0; for (int k = -2; k <= 2; k++) sum = sum +...