Question

(a) write the output of the following program. The output must include everything that a computer may produce on its screen,

B) draw the runtime stack fall the steps

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

Input two integers:
8 10
The bigger number is 10

Input two integers: 8 10 The bigger number is 10 ------------------------------- - Process exited after 2.459 seconds with re

b) Runtime Stack

Stack is divided in 3 segments.

Heap for dynamic variable

Stack for static and local variable

Code for function and main.

Heap
Stack

return

bigger()

main

n = 10

m = 8, n = 10

a = 8, b = 10

Code

bigger()
---------
---------
main():
----------
-----------

Add a comment
Know the answer?
Add Answer to:
B) draw the runtime stack fall the steps (a) write the output of the following program....
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
  • 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...

  • Consider the following program in which the statements are in the incorrect order. Rearrange the statements...

    Consider the following program in which the statements are in the incorrect order. Rearrange the statements so that the program prompts the user to input the height and the radius of the base of a cylinder and outputs the volume and surface area of the cylinder. Formant the output to two decimal places. #include <iomanip> #include <cmath> int main () {} double height; cout << ”Volume of the cylinder = “ <<PI * pow(radius, 2.0) * height << endl; cout...

  • The C++ code below will compile but has a variety of runtime issues. Identify a runtime...

    The C++ code below will compile but has a variety of runtime issues. Identify a runtime issue with the program and describe how you might fix the problem. #include <iostream> #include <vector> using namespace std; //------------------------------------------------------------------------------ int main() { vector<double> temps; // temperatures double temp = 0; double sum = 0; double high_temp = 0; double low_temp = 0; while (cin >> temp) // read and put into temps temps.push_back(temp); for (int i = 0; i < temps.size(); ++i) {...

  • PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program...

    PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: The height of the base of a cylinder The radius of the base of a cylinder The program then outputs (in order): The volume of the cylinder. The surface area of the cylinder Format the output to two decimal...

  • Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout...

    Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;

  • I am trying to write this code which asks "Write a program that ask the user,...

    I am trying to write this code which asks "Write a program that ask the user, the question: What is a^b? //The program generates two signed integers and gives the user four attempts to get the correct answer //a=- , b = + //a= + , b = - " So far this what I wrote. I am not sure how to do this correctly. #include<iostream> #include<cstdlib> #include<ctime> using namespace std; int main() {    srand(time(0));    int guess,a,ans,b, k;...

  • 4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std;...

    4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std; int main() { string playerName; cout << "Enter name"; cin >> playerName; cout << endl « playerName; return 0; } a. Tom - Sawyer b. Tom Sawyer c. Tom d. Sawyer 5) Which XXX generates "Adam is 30 years old." as the output? #include <iostream> using namespace std; int main() { string name = "Adam"; int age = 30; XXX return 0; } a....

  • Trying to solve the following problem based on the below program. It's from Chapter 2 in...

    Trying to solve the following problem based on the below program. It's from Chapter 2 in Computer Systems (Fourth Edition) by J. Stanley Warford Section 2.4 . The function sum in Figure 2.25 is called for the first time by the main program. From the second time on it is called by itself. "(a) How many times is it called altogether? (b) Draw a picture of the main program variables and the run-time stack just after the function is called...

  • I have a queue and stack class program that deals with a palindrome, I need someone...

    I have a queue and stack class program that deals with a palindrome, I need someone to help to put in templates then rerun the code. I'd greatly appreciate it. It's in C++. Here is my program: #include<iostream> #include<list> #include<iterator> #include<string> using namespace std; class Queue { public: list <char> queue; Queue() { list <char> queue; } void Push(char item) { queue.push_back(item); } char pop() { char first = queue.front(); queue.pop_front(); return first; } bool is_empty() { if(queue.empty()) { return...

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