Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

C++ ch9 extra

        Help!  

Question
Answer
What two reasons do programmers use functions for?   (1) so there is less duplication of code(2) to allow large and complex programs to be broken into small and manageable tasks.  
🗑
The main function returns its one value to the ___.   oeprating system.  
🗑
The ___ function returns a string of characters entered by the user at the keyboard.   getline()  
🗑
The ___ function returns the uppercase equivalent of a string.   toupper()  
🗑
What is the syntax of the pow function? Explain.   pow(x, y)x is the number you want raised to power y.  
🗑
To use the pow function ins a program, the program must contain the __ directive?   #include <cmath>  
🗑
cube = pow(4.0, 3) Explain   The double 4.0 is raised to the third power(4.0 * 4.0 * 4.0) and the answer is assigned to the cube variable.  
🗑
What is the syntax to specifiy the range of a random number? Write the formula for a range of 1 -6   lowerbound + rand() % (upperbound - lowerbound + 1)1 + rand() % (6 - 1 + 1);  
🗑
Show and explain the syntax of the srand function.   srand(seed)seed is an integer that represents the starting point for the random number generator.  
🗑
Most C++ programmers use the built-in __ function as the -seed-.   time()  
🗑
A program uses the statement discount = calcDisc(300.45); to call the calcDisc functions, which returns a number having a decimal place. Which is a valid function header for the calcDisc function?   double calcDisc(double sales)  
🗑
Most C++ programmers enter the function definition where?   below the main function in a program.  
🗑
A function prototype can be thought of as the ?   table of contents in a book. (simply a preview of what will be expanded on later)  
🗑
What is the syntax of a function prototype? Give an example.   returnDataType functionName(parameterList);int calcRectangleArea(int, int);  
🗑
What is the difference between a function header and a function prototype?   (1) A function prototype ends with a semicolon.(2)The function header contains both the data type and name of each formal paramter, but the function prototype contains only the data type.  
🗑
The function prototype is necessary only when ?   the function is defined after the main() function.  
🗑
The formal parameters are defined in the ?   function definitions  
🗑


   

Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
 
To hide a column, click on the column name.
 
To hide the entire table, click on the "Hide All" button.
 
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
 
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.

 
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how
Created by: kat1350
Popular Computers sets