STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 2.7, Problem 2.12CP
A) From the table 2-6:
Program Plan Intro
Data types:
The variables use data-type during their declaration.
- The data-type is used to determine the size of memory allocated. Here, the compiler allots the memory.
- All data-type needs different size of memory.
Some of the data-types are:
- Integer
- Boolean
- Character
- Double
- Floating point
B)
Program Plan Intro
Data types:
The variables use data-type during their declaration.
- The data-type is used to determine the size of memory allocated. Here, the compiler allots the memory.
- All data-type needs different size of memory.
Some of the data-types are:
- Integer
- Boolean
- Character
- Double
- Floating point
C)
Program Plan Intro
Data types:
The variables use data-type during their declaration.
- The data-type is used to determine the size of memory allocated. Here, the compiler allots the memory.
- All data-type needs different size of memory.
Some of the data-types are:
- Integer
- Boolean
- Character
- Double
- Floating point
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Flowchart , code , output
10. Local variables are known only in the function in which they are defined.
Local variables are known only in the function in which they are defined.
True
O False
11. All types of functions can return more than one value.
All types of functions can return more than one value.
True
False
I need the answer as soon as possible
Chapter 2 Solutions
STARTING OUT WITH C++ MPL
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.1 - On paper, write a program that will display your...Ch. 2.3 - Prob. 2.3CPCh. 2.3 - What output will the following lines of code...Ch. 2.3 - On paper, write a program that will display your...Ch. 2.5 - Which of the following are legal C++ assignment...Ch. 2.5 - List all the variables and literals that appear...Ch. 2.5 - When the above main function runs, what will...Ch. 2.5 - When the following main function runs, what will...Ch. 2.7 - Which of the following are illegal C++ variable...
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Prob. 2.12CPCh. 2.7 - Prob. 2.13CPCh. 2.7 - How would you combine the following variable...Ch. 2.7 - How would you combine the following variable...Ch. 2.8 - Prob. 2.16CPCh. 2.8 - What will the following code display? int number;...Ch. 2.8 - Prob. 2.18CPCh. 2.10 - Prob. 2.19CPCh. 2.10 - Which of the following is a character literal? 'B'...Ch. 2.10 - Prob. 2.21CPCh. 2.10 - What is wrong with the following program...Ch. 2.10 - Prob. 2.23CPCh. 2.10 - Write a program that stores your name, address,...Ch. 2.15 - Is the following assignment statement valid or...Ch. 2.15 - What is wrong with the following program? How...Ch. 2.15 - What will be assigned to x in each of the...Ch. 2.15 - Prob. 2.28CPCh. 2 - Every complete statement ends with a _____.Ch. 2 - To use cout statements you must include the _____...Ch. 2 - Every C++ program must have a function named...Ch. 2 - Prob. 4RQECh. 2 - A group of statements, such as the body of a...Ch. 2 - 'A', and "Hello World" are all examples of _____.Ch. 2 - 978.65 1012 would be written in E notation as...Ch. 2 - Prob. 8RQECh. 2 - Indicate if each of the following assignment...Ch. 2 - If the variables letter and w have been defined as...Ch. 2 - Indicate if each of the following cout statements...Ch. 2 - Indicate if each of the following cout statements...Ch. 2 - Assume integers x = 4, y = 7, and z = 2. What...Ch. 2 - Assume double variables x = 2.5, y = 7.0, and z =...Ch. 2 - Write a C++ statement that defines the double...Ch. 2 - Write a C++ statement that defines the int...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Modify the following program segment so it prints...Ch. 2 - Rewrite the follow statement to use the newline...Ch. 2 - Create detailed pseudocode for a program that...Ch. 2 - Prob. 22RQECh. 2 - Prob. 23RQECh. 2 - Create detailed pseudocode for a program that...Ch. 2 - What will the following programs print on the...Ch. 2 - A) #include iostream using namespace std; int main...Ch. 2 - The following program contains many syntax errors....Ch. 2 - Soft Skills Programmers need good communication...Ch. 2 - Sum of Two Numbers Write a program that stores the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Sales Tax Write a program that computes the total...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Miles per Gallon A car holds 16 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20 gallon...Ch. 2 - Number of Acres One acre of land is equivalent to...Ch. 2 - Land Calculation In the United States, land is...Ch. 2 - Circuit Board Price An electronics company makes...Ch. 2 - Prob. 10PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Pay Period Gross Pay A particular employee earns...Ch. 2 - Basketball Player Height The star player of a high...Ch. 2 - Stock Loss Kathryn bought 750 shares of stock at a...Ch. 2 - Energy Drink Consumption A soft drink company...Ch. 2 - Past Ocean Levels The Earths ocean levels have...Ch. 2 - Future Ocean Levels During the past decade ocean...Ch. 2 - Annual High Temperatures The average July high...Ch. 2 - How Much Paint A particular brand of paint covers...
Knowledge Booster
Similar questions
- Complete the function movie_cost, which takes three parameters: age, permission and rating. age is an integer containing a person's age in years; permission is a Boolean that indicates whether a person has parental permission to see a particular move; and rating is one of G, PG, PG-13, or R. The function returns the cost of movie theater admission for the person according to the following rules, which are listed in order of decreasing precedence/priority: Nobody under the age of 10 may view an R-rated movie. • You must be 17 years old or have parental permission to view an R-rated movie. • You must be at least 13 years old or have parental permission to view a PG-13-rated movie. Prices: • Adult tickets (age greater than or equal to 16) are $15 each. • Child tickets (age less than 16) are $10 each. • If the person is not allowed to see the move, return o. Examples: Function Call movie_cost (17, False, 'R') movie_cost (16, True, 'R') movie_cost (12, True, 'R') Return Value 15 15 10…arrow_forwardAnsvered: The results from x Blendeo Assessment Answered: Wrte a progran Aniveredi Write a progran my msu college Blended Assessment System (BEZ) Question 5 Write the complete C++ program for the following Case 2. ML marketing is a registered company that sells various house hold items. Their members will be given commission based on the sales they did for every months. The table for the commission is provided as follows: Sales Amount (RM) Rate (%) Amount 10000 12 The system reads the member's ID (int value), the month of the sales and sales amount. It then displays ALL the details during the input process together with the commission rate and the total commission the member gets. You are required to write a program for the above problem. Your program must use the following function prototypes (you need to determine the formal parameter (if any)): double RateCommission (); // to determine the rate based on the given sales amount and return the rate to main (). void Totalcommission ();…arrow_forwardWhich statement of the following is the most appropriate? Group of answer choices One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the assertion-checking can later be turned off if program speed is a consideration. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the…arrow_forward
- Question 1 You have to define the data type declaration for a variable that will store a string of text of 100 characters. You will be referencing the variable as a string and not as a series of individual characters. Assume the variable is called strText. What is the data definition for the variable?arrow_forwardSelect correct choice about functions? A) Each function should be written multiple times and it can be called once. B) Each function should be written once and it can be called multiple times. C) All of these choices. (D) Each function should be written once and it can be called once.arrow_forwardkindly use c++ language and optimize functions, pointers and OOParrow_forward
- True/False 1. Programmers rarely define their own functionsarrow_forwardhelp me create this c++ program please Requirements: The following programming structures must be evident in your source code. Conditional structure Looping structure Array Programmer-Defined Function (do not create a header file)arrow_forwardPlease solve the program using visual-studio-2010 (Important)arrow_forward
- Use functional decomposition to write a C+ program that asks the user to enter his or her weight and the name of a planet. Use an enumerated type called planetType to represent the planets and use a switch statement that takes as its condition a planetType variable. The program, via the switch statement, then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet. Your program must have the following functions in it: GetUserInput(), ConvertInputToPlanetType(), and OutputWeight() (your switch statement must be in OutputWeight(). I will let you determine what each function's parameters and return types should be. The program will output an error message if the user does not type a correct planet name. The prompt and the error message will make it clear to the user how a planet name must be entered. Use proper formatting and appropriate comments in your code. The output must be labeled clearly and…arrow_forwardExplain the use of cast operator.arrow_forwardProgramming Language: C++ 3. Which of the following are true for static variables but not for other variables? Select one or more: a. If they are defined and initialized on the same line, this line is guaranteed to only be executed once. b. They can only be used in the scope where they are defined. c. They can be used as arguments when calling a function d. They retain the value stored in them even after the function where they are defined returns e. They can be defined and initialized on the same line.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning