STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6.15, Problem 6.26CP
What is the output of the following
int manip(int);
int manip(int, int);
int manip(int, double);
int main()
{
int x = 2, y= 4, z;
double a = 3.1;
z = manip(x) + manip(x, y) + manip(y, a);
cout << z << endl;
return 0;
}
int manip(int val)
{
return val + val * 2;
}
int manip(int vail, int val2)
{
return (vail + val2) * 2;
}
int manip(int vail, double val2)
{
return vail * static_cast<int>(val2);
}
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1.
above?
#include
int c = 2;
int f1(int a, int b);
int f2(int a, int b);
int main()
{
}
int
{
int a = 3;
int b;
b = f1(c, a);
printf("%d", b);
return 0;
f1(int a, int b)
int d = f2(b,a);
return d;
}
int f2(int a, int b)
{
}
int d = a*b + c*b;
return d;
) What is the output of the program shown
#include
using namespace std;
const int y = 1;
int main () {
int static y = 2;
int i = 3, j
= 4, m = 5, n = 6;
%3D
int a = [] (int x, int i = 1) { return x * i; } (y, 3) ;
%3D
int b = [=] (int x) { return [=] (int b) { return b + j; } (x) % 7; } (a);
int c = [=] (int x) mutable ->int {
m = 6;
return [6] (int j) mutable {
y = a * b;
return y / j;
} (x) -m;
} (b) ;
cout << a << endl;
cout << b << endl;
cout << c << endl;
cout << m << endl;
cout << y < endl;
return 0;
This program outputs 5 lines. What are they? Please explain your work and your answer.
Debug the program and make it run.
Chapter 6 Solutions
STARTING OUT WITH C++ MPL
Ch. 6.2 - Use the following information to answer questions...Ch. 6.2 - Use the following information to answer questions...Ch. 6.2 - Prob. 6.3CPCh. 6.2 - Use the following information to answer questions...Ch. 6.2 - Use the following information to answer questions...Ch. 6.2 - Use the following information to answer questions...Ch. 6.5 - Indicate which of the following is the function...Ch. 6.5 - A) Write the function header for a function named...Ch. 6.5 - What is the output of the following program?...Ch. 6.5 - The following program skeleton asks for the number...
Ch. 6.9 - How many return values may a function have?Ch. 6.9 - Write a header for a function named distance. The...Ch. 6.9 - Write a header for a function named days. The...Ch. 6.9 - Prob. 6.14CPCh. 6.9 - Write a header for a function named lightYears....Ch. 6.11 - What is the difference between a static local...Ch. 6.11 - Prob. 6.17CPCh. 6.11 - Prob. 6.18CPCh. 6.13 - Prob. 6.19CPCh. 6.13 - Write the prototype and header for a function...Ch. 6.13 - Write the prototype and header for a function...Ch. 6.13 - What is the output of the following program?...Ch. 6.13 - The following program asks the user to enter two...Ch. 6.15 - Is it required that overloaded functions have...Ch. 6.15 - What is the output of the following program code?...Ch. 6.15 - What is the output of the following program code?...Ch. 6 - The ____ is the part of a function definition that...Ch. 6 - If a function doesnt return a value, the word...Ch. 6 - If function showValue has the following header:...Ch. 6 - Either a functions ____ or its ____ must precede...Ch. 6 - Values that are sent into a function are called...Ch. 6 - Special variables that hold copies of function...Ch. 6 - When only a copy of an argument is passed to a...Ch. 6 - A(n)_____ eliminates the need to place a function...Ch. 6 - A(n)_____ variable is defined inside a function...Ch. 6 - ____ variables are defined outside all functions...Ch. 6 - _____ variables provide an easy way to share large...Ch. 6 - Unless you explicitly initialize numeric global...Ch. 6 - If a function has a local variable with the same...Ch. 6 - ______ local variables retain their value between...Ch. 6 - The _____ statement causes a function to end...Ch. 6 - ______ arguments are passed to parameters...Ch. 6 - When a function uses a mixture of parameters with...Ch. 6 - Prob. 18RQECh. 6 - When used as parameters, _______ variables allow a...Ch. 6 - Reference variables are defined like regular...Ch. 6 - Reference variables allow arguments to be passed...Ch. 6 - The ________ function causes a program to...Ch. 6 - Two or more functions may have the same name, as...Ch. 6 - What is the advantage of breaking your...Ch. 6 - What is the difference between an argument and a...Ch. 6 - When a function accepts multiple arguments, does...Ch. 6 - What does it mean to overload a function?Ch. 6 - If you are writing a function that accepts an...Ch. 6 - Give an example of where an argument should he...Ch. 6 - How do you return a value from a function?Ch. 6 - Prob. 31RQECh. 6 - Prob. 32RQECh. 6 - The following statement calls a function named...Ch. 6 - A program contains the following function, int...Ch. 6 - Write a function, named timesTen, that accepts an...Ch. 6 - A program contains the following function. void...Ch. 6 - Write a function named getNumber, which uses a...Ch. 6 - Write a function named biggest that receives three...Ch. 6 - Prob. 39RQECh. 6 - Markup Write a program that asks the user to enter...Ch. 6 - Celsius Temperature Table The formula for...Ch. 6 - Falling Distance The following formula can be used...Ch. 6 - Kinetic Energy In physics, an object that is in...Ch. 6 - Winning Division Write a program that determines...Ch. 6 - Shipping Charges The Fast Freight Shipping Company...Ch. 6 - Prob. 7PCCh. 6 - Lowest Score Drop Write a program that calculates...Ch. 6 - Star Search A particular talent competition has...Ch. 6 - isPrime Function A prime number is an integer...Ch. 6 - Present Value Suppose you want to deposit a...Ch. 6 - Future Value Suppose you have a certain amount of...Ch. 6 - Stock Profit The profit from the sale of a stock...Ch. 6 - Multiple Stock Sales Use the function that you...Ch. 6 - Order Status The Middletown Wholesale Copper Wire...Ch. 6 - Overloaded Hospital Write a program that computes...Ch. 6 - Population In a population, the birth rate is the...Ch. 6 - Transient Population Modify Programming Challenge...Ch. 6 - Using FilesHospital Report Modify Programming...Ch. 6 - Group Project 20. Using FilesTravel Expenses This...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In what year was Plankalkl designed? In what year was that design published?
Concepts of Programming Languages (11th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
Name the steps in the programming process.
Digital Fundamentals (11th Edition)
Write an application that estimates the value of the mathematical constant e by using the following formula. Al...
Java How To Program (Early Objects)
Private Sub Handles btnOutput.Click
End Sub
Introduction To Programming Using Visual Basic (11th Edition)
This type of function returns either True or False. a. Binary b. TrueFalse c. Boolean d. logical
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Number of digits int main() {int c=0;int i=3856; int l=i; while(l>0) {l=l/10; c++; } printf("%d",c); return 0; } Summation of digits int main() {int sum=0; int i=384; int l=i; while(l>0) { sum+=l%10; l=l/10;} printf("%d",sum); return 0; }arrow_forwardDraw a flowchart for the Frazzle function.arrow_forward#include int k=0; int f(int t) { k += t; heturn k; } void main() { int i, result=1; for(i = 1;i <= 3;i++) result = f(i); printf("%d\n", result); } A 3 B C) 1 D 123arrow_forward
- PROBLEM STATEMENT: An anagram is a word that has been rearranged from another word, check tosee if the second word is a rearrangement of the first word. public class AnagramComputation{public static boolean solution(String word1, String word2){// ↓↓↓↓ your code goes here ↓↓↓↓return true;}} Can you help me with this java question the language is java please use the code I gavearrow_forwardint f(int &k){k++;return k * 2;}int main(){int i = 1, j = -1;int a, b, c;a = f(i) + i/2;b = j + f(j) + f(j);c = 2 * f(j);return 0;} What are the values of a, b and c id the operands in the expressions are evaluated from left to right and then what are the values when its evaluated right to left?arrow_forwardint j; for (int i = 0; i < 5; i++) {j = 2*j*i;} What is j?arrow_forward
- void main (void) { char result = a; for (char i = { 10; i > 5; i = i-1) result = result + i; } // point B } Consider the code above. What is the decimal value of "result" at "point B" if the variable "a" is initially 59?arrow_forwardFor the C++ program show on the next page, answer the questions that follow. The names g, j, x, and y are declared multiple times. Distinguish uses of these names using line numbers where they were declared as subscripts. a. At point A in the program, what names are in scope? b. At point A in the program, what variables are live? c. At point B in the program, what names are in scope? d. At point B in the program, what variables are live?arrow_forwardmport java.util.Scanner; public class ParkingCharges { // function to calculate the basic charge using the asked hours static double getBasicCharge(int hours) { if (hours >= 7 && hours <= 8) return 5.50; else if (hours >= 5 && hours <= 6) return 4.50; else if (hours >= 2 && hours <= 4) return 4.00; return 3.00; } // function to return the amount to subtract based on local living and OAP static double getDiscount(String isLocal, String isOAP) { if (isOAP.equals("Yes") && isLocal.equals("Yes")) return 2.0 + 1.0; else if (isOAP.equals("Yes")) return 2.0; else if (isLocal.equals("Yes")) return 1.0; return 0; } public static void main(String[] args) { // create a new Scanner object Scanner sc = new Scanner(System.in); // prompt the user to ask if they are disabled…arrow_forward
- // SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…arrow_forwardQuestion public class MyProgram { if (h 18) { public static void main(String[] args) { int h=10, t-22; System.out.print ("Good "); } } else } } What is the output displayed by the following lines of code?" System.out.print ("Morning"); t = t + 2; if (t > 30) System.out.println(" Every one!"); System.out.println("The Your answer system.out.print("Evening"); t = t + 5; temperature is " System.out.println(" Brink water?"); Degree.");arrow_forwardint test(int *x, int y){ x=&y; return(*x+y); } int main(void) { int x=1, y=6; test(&y, x); printf("%d %d %d", x, test (&y,x),y); return 0; } 1 2 6arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY