1 Introduction To Computers And Programming 2 Introduction To C++ 3 Expressions And Lnteractivity 4 Making Decisions 5 Loops And Files 6 Functions 7 Arrays And Vectors 8 Searching And Sorting Arrays 9 Pointers 10 Characters, C-strings, And More About The String Class 11 Structured Data 12 Advanced File Operations 13 Introduction To Classes 14 More About Classes 15 Inheritance, Polymorphism, And Virtual Functions 16 Exceptions And Templates 17 The Standard Template Library 18 Linked Lists 19 Stacks And Queues 20 Recursion 21 Binary Trees expand_more
6.1 Focus On Software Engineering: Modular Programming 6.2 Defining And Calling Functions 6.3 Function Prototypes 6.4 Sending Data Into A Function 6.5 Passing Data By Value 6.6 Focus On Software Engineering: Using Functions In A Menu-driven Program 6.7 The Return Statement 6.8 Returning A Value From A Function 6.9 Returning A Boolean Value 6.10 Local And Global Variables 6.11 Static Local Variables 6.12 Default Arguments 6.13 Using Reference Variables As Parameters 6.14 Overloading Functions 6.15 The Exit () Function 6.16 Stubs And Drivers Chapter Questions expand_more
Problem 1RQE: Why do local variables lose their values between calls to the function in which they are defined? Problem 2RQE: What is the difference between an argument and a parameter variable? Problem 3RQE: Where do you define parameter variables? Problem 4RQE: If you are writing a function that accepts an argument and you want to make sure function cannot... Problem 5RQE: When a function accepts multiple arguments, does it matter in what order the arguments are passed? Problem 6RQE: How do you return a value from a function? Problem 7RQE: What is the advantage of breaking your applications code into several small procedures? Problem 8RQE: How would a static local variable be useful? Problem 9RQE: Give an example where passing an argument by reference would be useful. Problem 10RQE: The_______ is the part of a function definition that shows the function name, return type, and... Problem 11RQE: If a function doesnt return a value, the word _______ will appear as its return type. Problem 12RQE: Either a functions _______ or its _______ must precede all calls to the function. Problem 13RQE: Values that are sent into a function are called _______. Problem 14RQE: Special variables that hold copies of function arguments are called _______. Problem 15RQE: When only a copy of an argument is passed to a function, it is said to be passed by _______. Problem 16RQE: A(n) _______ eliminates the need to place a function definition before all calls to the function. Problem 17RQE: A(n) _______ variable is defined inside a function and is not accessible outside the function. Problem 18RQE: _______ variables are defined outside all functions and are accessible to any function within their... Problem 19RQE: _______ variables provide an easy way to share large amounts of data among all the functions in a... Problem 20RQE: Unless you explicitly initialize global variables, they are automatically initialized to _______. Problem 21RQE: If a function has a local variable with the same name as a global variable, only the _______... Problem 22RQE: _______ local variables retain their value between function calls. Problem 23RQE: The _______ statement causes a function to end immediately. Problem 24RQE: _______ arguments are passed to parameters automatically if no argument is provided in the function... Problem 25RQE: When a function uses a mixture of parameters with and without default arguments, the parameters with... Problem 26RQE Problem 27RQE: When used as parameters, _______ variables allow a function to access the parameters original... Problem 28RQE: Reference variables are defined like regular variables, except there is a(n) _______ in front of the... Problem 29RQE: Reference variables allow arguments to be passed by _______. Problem 30RQE: The _______ function causes a program to terminate. Problem 31RQE: Two or more functions may have the same name, as long as their _______ are different. Problem 32RQE: Examine the following function header, then write an example call to the function: void... Problem 33RQE: The following statement calls a function named half. The half function returns a value that is half... Problem 34RQE: A program contains the following function: int cube(int num) { return num num num; } Write a... Problem 35RQE: Write a function named timesTen that accepts an argument. When the function is called, it should... Problem 36RQE: A program contains the following function: void display(int arg1, double arg2, char arg3) { cout ... Problem 37RQE: Write a function named getNumber that uses a reference parameter variable to accept an integer... Problem 38RQE: T F Functions should be given names that reflect their purpose. Problem 39RQE Problem 40RQE: T F Function prototypes are terminated with a semicolon. Problem 41RQE: T F If other functions are defined before main, the program still starts executing at function main. Problem 42RQE: T F When a function terminates, it always branches back to main, regardless of where it was called... Problem 43RQE: T F Arguments are passed to the function parameters in the order they appear in the function call. Problem 44RQE: T F The scope of a parameter is limited to the function that uses it. Problem 45RQE: T F Changes to a function parameter always affect the original argument as well. Problem 46RQE: T F In a function prototype, the names of the parameter variables may be left out. Problem 47RQE: T F Many functions may have local variables with the same name. Problem 48RQE: T F Overuse of global variables can lead to problems. Problem 49RQE: T F Static local variables are not destroyed when a function returns. Problem 50RQE: T F All static local variables are initialized to 1 by default. Problem 51RQE: T F Initialization of static local variables only happens once, regardless of how many times the... Problem 52RQE: T F When a function with default arguments is called and an argument is left out, all arguments that... Problem 53RQE: T F It is not possible for a function to have some parameters with default arguments and some... Problem 54RQE: T F The exit function can only be called from main. Problem 55RQE: T F A stub is a dummy function that is called instead of the actual function it represents. Problem 56RQE: Each of the following functions has errors. Locate as many errors as you can. 56. void total (int... Problem 57RQE: double average(int value1, int value2, int value3) { double average; average = value1 + value2 +... Problem 58RQE: void area(int length =30, int width) { return length width; } Problem 59RQE: void getValue(int value) { cout "Enter a value: "; cin value; } Problem 60RQE: (Overloaded functions) int getValue() { int inputValue; cout "Enter an integer: "; cin inputValue;... Problem 1PC: Markup Write a program that asks the user to enter an items wholesale cost and its markup... Problem 2PC: Rectangle AreaComplete the Program If you have downloaded this books source code, you will find a... Problem 3PC: Winning Division Write a program that determines which of a companys four divisions (Northeast,... Problem 4PC: Safest Driving Area Write a program that determines which of five geographic regions within a major... Problem 5PC: Falling Distance When an object is falling because of gravity, the following formula can be used to... Problem 6PC: Kinetic Energy In physics, an object that is in motion is said to have kinetic energy. The following... Problem 7PC: Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is... Problem 8PC: Coin Toss Write a function named coinToss that simulates the tossing of a coin. When you call the... Problem 9PC: Present Value Suppose you want to deposit a certain amount of money into a savings account and then... Problem 10PC: Future Value Suppose you have a certain amount of money in a savings account that earns compound... Problem 11PC: Lowest Score Drop Write a program that calculates the average of a group of test scores, where the... Problem 12PC: Star Search A particular talent competition has five judges, each of whom awards a score between 0... Problem 13PC: Days Out Write a program that calculates the average number of days a companys employees are absent.... Problem 14PC: Order Status The Middletown Wholesale Copper Wire Company sells spools of copper wiring for 100... Problem 15PC: Overloaded Hospital Write a program that computes and displays the charges for a patients hospital... Problem 16PC: Population In a population, the birth rate is the percentage increase of the population due to... Problem 17PC: Transient Population Modify Programming Challenge 16 to also consider the effect on population... Problem 18PC: Paint Job Estimator A painting company has determined that for every 110 square feet of wall space,... Problem 19PC Problem 20PC: Stock Profit The profit from the sale of a stock can be calculated as follows:... Problem 21PC: Multiple Stock Sales Use the function that you wrote for Programming Challenge 20 (Stock Profit) in... Problem 22PC: isPrime Function A prime number is a number that is only evenly divisible by itself and 1. For... Problem 23PC Problem 24PC: Rock, Paper, Scissors Game Write a program that lets the user play the game of Rock, Paper, Scissors... Problem 25PC: Group Project 25. Travel Expenses This program should be designed and written by a team of students.... format_list_bulleted