/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Free solutions & answers for Problem Solving with C++ Chapter 5 - (Page 1) [step by step] | 91Ó°ÊÓ

91Ó°ÊÓ

Problem 1

include void friendly( ); void shy(int audience_count); int main( ) { using namespace std; friendly( ); shy(6); … # What is the output of the following program? #include void friendly( ); void shy(int audience_count); int main( ) { using namespace std; friendly( ); shy(6); cout << "One more time:\n"; shy(2); friendly( ); cout << "End of program.\n"; return 0; } void friendly( ) { using namespace std; cout << "Hello\n"; } void shy(int audience_count) { using namespace std; if (audience_count < 5) return; cout << "Goodbye\n"; } The \(\mathrm{C}++\) Standard says that you can omit the return \(\theta\) in the main part, but many compilers still require it.

Problem 2

Are you required to have a return statement in a void function definition?

Problem 4

Write a definition for a void function that has three arguments of type int and that outputs to the screen the product of these three arguments. Put the definition in a complete program that reads in three numbers and then calls this function.

Problem 6

Is a call to a void function used as a statement or is it used as an expression?

Problem 10

Write a void function definition for a function called zero_both that has two reference parameters, both of which are variables of type \(i n t,\) and sets the values of both variables to \(\theta\)

Problem 11

Write a void function definition for a function called add_tax. The function add_tax has two formal parameters: tax_rate, which is the amount of sales tax expressed as a percentage, and cost, which is the cost of an item before tax. The function changes the value of cost so that it includes sales tax.

Problem 12

Can a function that returns a value have a call-by-reference parameter? May a function have both call-by-value and a call-by-reference parameters?

Problem 13

Can a function definition appear inside the body of another function definition?

Problem 14

Can a function definition contain a call to another function?

Problem 16

Give a precondition and a postcondition for the predefined function sqrt, which returns the square root of its argument.

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks