C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 6, Problem 7SA

Consider the following statements:

int num1, num2, num3; double length, width, height; double volume; num1 = 6; num2 = 7; num3 = 4; length =6 .2;width =2 .3; height =3 .4; and the function prototype: double box ( double, double, double ) ;

Which of the following statements are valid? If they are invalid, explain why. (4)

  1. volume = box (length, width, height);

  2. volume = box (length, 3.8, height);

  3. cout << box(num1, num3, num2) << endl;

  4. cout << box (length, width, 7.0)<< endl;

  5. volume = box (length, num1, height);

  6. cout <<box(6.2, height) << endl;

  7. volume = box (length + width, height)

  8. volume = box (num1, num2 + num3) ;

Blurred answer
Students have asked these similar questions
The Issue: You have a function that accepts a variety of parameters. It is impractical to provide them as traditional parameters. So, what are you going to do?
Consider the following program: #include /* function declaration */ void function(int x, int *y, int *z); int main() { int a = 100, b, c ; function (a, &b, &c); } void function(int x, int *y, int *z) { x = x + 2; *y = x - 1; *z = x + 1; } What are the final values of a, b, and c respectively? Select one: O a. (100, 101, 103 ) O b. (102, 101, 103) O c. (100, 99, 101) O d. (102, 99, 101)
17. A function should determine the average of x and y. What should be the function's parameters and return value(s)? A.Parameters: none Return values: X,y B.Parameters: ×, y, average Return value: none C.Parameters: average Return values; X, y D.Parameters: X, y Return value: average
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY