Why do we have both debug and release builds

Assignment Help Programming Languages
Reference no: EM13947600

1. Write a program that reads in an integer from the keyboard and displays its value doubled, using two functions that you write. The reading function should be int and the displaying function should be void.

2. How does the use of inline speed up the execution of a program? What is the disadvantage of using inline?

3. What is the output produced by the following program? Explain.

#include <iostream>
using namespace std;
void testfunc(int x, int y = 10) {
cout << x + y;
}
int main () {
testfunc(3);
return 0;
}

4. What is the output of the following program? Explain.

#include <iostream>
using namespace std;
void f(int i, int &j) {
i = 5;
j = j + i;
cout << "f: i = " << i << endl;
cout << "f: j = " << j << endl;
}
int main () {
int i = 15;
int j = 30;
f(i, j);
cout << " main: i = " << i << endl;
cout << " main: j = " << j << endl;
}

5. Write a program that reads in two integers from the keyboard and displays their sum. The reading function should read in both integers at the same time. Both the reading and displaying functions should be separate void functions.

6. What is the output of the following program? Explain.

#include <iostream>
using namespace std;
float someNum = 3.0;
int main () {
int someNum = 2;
cout << someNum << endl;
cout << ::someNum << endl;
return 0;
}

7. When two or more functions have the same name, how does the compiler determine which one to use for a particular function call?

8. Write a void function called swap that takes two integer parameters and swaps their contents. Write another swap function that takes two double arguments. Write a short main function that calls both swap functions and demonstrates that the contents have been swapped. Cout statements should only appear in function main.

9. Why do we have both debug and release builds?

10. What is the difference between step over, and step into?

11. Find and describe the errors in the following program. Use the debugger.

//this program computes how much money will
//accumulate after so many years of investing
#include <iostream>
using namespace std;
double Balance = 0.0;
double Interest;
double YearlyCont;
int NumYears;
//this function computes one year of investment
double newBalance(double balance);
int main () {
cout << "How much money will you deposit"
<< "each year?" << endl;
cin >> YearlyCont;
cout << "What interest rate will you get"
<<"(enter 5% as .05)?" << endl;
cin >> Interest;
cout << "How many years will you invest?"
<< endl;
cin >> NumYears;
for(int i = 1; i <= NumYears; i++);
Balance = newBalance(Balance);
cout << "Money at end of investment: "
<< Balance << endl;
return 0;
}
double newBalance(double balance) {
//add in this year's deposit
balance = balance + YearlyCont;
//add in this year's interest
balance = (Interest + 1.0) * Balance;
return balance;
}

Reference no: EM13947600

Questions Cloud

Expected return of your portfolio : You have $69000, you put 18% of your money in a stock with an expected return of 12%, $40000 in a stock with an expected return of 17%, and the rest in a stock with an expected return of 18%. What is the expected return of your portfolio?
Radiation exchange with the ground : 1. Consider the transmission case of Problem 1.23, but now allow for radiation exchange with the ground/ chassis, which may be approximated as large surround- ings at Tsur = 30°C. If the emissivity of the case is s = 0.80, what is the surface tempe..
Provide both qualitative and quantitative reasoning in memo : Prepare a memo to the president that details your analysis and reasoning and recommends one of the two alternatives. Provide both qualitative and quantitative reasoning in the memo.
Target capital structure calls debt and common equity : For a company whose target capital structure calls for 50% debt and 50% common equity, which of the following statements is CORRECT? The interest rate used to calculate the WACC is the average after-tax cost of all the company’s outstanding debt as s..
Why do we have both debug and release builds : When two or more functions have the same name, how does the compiler determine which one to use for a particular function call?
Stocks dividend is expected to grow at constant rate : If a stock’s dividend is expected to grow at a constant rate of 5% a year, which of the following statements is CORRECT? The stock is in equilibrium.
Surroundings and ambient temperatures : The solid sili- con powder is at Tsi,i = 298 K, and the solid silicon sheet exits the chamber at Tsi,o = 420 K. Both the surroundings and ambient temperatures are T00 = Tsur = 298 K.
Formulate zero-net-investment arbitrage portfolio : Suppose the 1-year futures price on a stock-index portfolio is 1,624, the stock index currently is. Formulate a zero-net-investment arbitrage portfolio and show that you can lock in riskless profits equal to the futures mispricing.
How will you use it to improve purchasing process : In today's technology and Internet mediated environment, how will you use IT to improve purchasing process

Reviews

Write a Review

Programming Languages Questions & Answers

  Create a class that simulates an alarm clock

Store time in hours, minutes, and seconds. Note if time is AM or PM. (Hint: You should have separate private members for the alarm and the clock. Do not forget to have a character variable representing AM or PM.)

  Write an algorithm that converts a linear measurement

Write an algorithm that converts a linear measurement in feet and inches into meters. One inch is equivalent to 2.54 centimeters.

  General layout for a web-based source document

Suggest the general layout for web-based source document that prospective sellers could use to explain their antiques. Information must include the user ID, password, item, dimensions, origin, condition, and asking price.

  Write a program that calculates a cars gas mileage

Write a program that calculates a car's gas mileage - The program should ask the user to enter the number of gallons of gas the car hold and the number of miles it can be driven on a full tank.

  Define procedural or algorithmic programming what is

what is procedural or algorithmic programming? what is object-oriented programming? what is the role of code reuse in

  You have been hired by a school district

You have been hired by a school district to write a program that will grade multiple choice exams and providea report listing the grade (numeric and letter) for each student, the problems missed for each student.

  Program to compute grade point average

Write a program that uses such a file to calculate your grade point average(GPA). A GPA is based on a scale from 5, where A is 4, B is 3, C is 2, D is 1 and F is 0.

  Create security code program-display digit-ascii character

You have been hired to create the security code program. Program must permit user to enter message, one character at a time.

  Identify why the two tests fail and correct the code

Your first task in this assignment is to study the given code, identify why the two tests fail, and correct the code.

  Write the code to display a menu and test it

Write a method to display instructions to the user, Write the code to display a menu and test it, Write the code to display the contents of the data file line by line

  Explain how perl deallocates dynamic memory

It's one thing to TALK about how Perl manages dynamic memory. it is another thing completely to SEE how Perl manages dynamic memory.

  Write a program that takes three command-linearguments

Write a program that takes three command-linearguments number operator number and performs the required operation and prints the result on a single complete line in standard output.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd