Question

Part #2 Trace and show your steps and the output of the following code segment const int TEN = 10; int a(TEN), n = 354, num,
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1st question answer

chang of Nalu of Voiables Line (Means Line Trainy 10 nt TEN= TEN, aTEN n num c Const n354,num,c=0 araTENJ aiEN] That is all hatct) num % TEN 5 Caut es akkJ a1 =num/ TEN aG 35 10 a0-5 k 1-10 20 k=k-1; Czlt k>-0 00oop itus krminals CE 2 nume num/TEN aE

in simple steps

TEN, aTEN, n, num to 0000, 35 0 1o fo,000,0,0,35 3 loop started 1o 4,0,0,0,0 3 3y 1 -0,01010,03 35 flerations Complated- firsTEN ahEN C n num k O-I0 false leminakd loop for loop shted I6 from step aften now a] d is prihed Cout endend w new Gn qkJ- af

program and output

.Cpp #include <iostream> 2 using namespace std; 3 int main() 4 1 const int TEN 10; int a[TEN],n-354, num, c-0; 5 6 7 num-n; 8

2nd question answer

int A=6,sT, ss, 88, 73,063 for loop beg & k num AF /Fntsf 4,r,73, ,0,0p.0 ACGI AC] £6 66 55 Ab hum &07- f0,0,0,0,0,0,0 A (03-

Afu snum 88>55 B(ki+]A 2J=8k2l=3 A 0 jtl ST 3 6131,463 0,01 -Toa oTOn Afr]snum 0-UA B(ktt) ACi k 3tl BC3] 77 j-5H6 AGJ-0 fo,T

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

Add a comment
Know the answer?
Add Answer to:
Part #2 Trace and show your steps and the output of the following code segment const...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following code segment, what is the output? //you please explain your answer with all...

    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]...

    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...

    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...

    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...

    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...

    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...

    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...

    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;...

    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...

    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 +...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT