Starting Out with C++: From Control Structures through Objects, Brief Version (8th Edition)
8th Edition
ISBN: 9780134037325
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 2, Problem 10RQE
Program Description Answer
“#include <iostream>” is the correct statement to include header file.
Hence, the correct answer is option “C”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C++ Help Please!
Complete the code provided to add the appropriate amount to totalDeposit.
#include <iostream>using namespace std;
int main() { enum AcceptedCoins {ADD_QUARTER, ADD_DIME, ADD_NICKEL, ADD_UNKNOWN}; int totalDeposit = 0; int userInput;
totalDeposit = 0;
cout << "Add coin: 0 (add 25), 1 (add 10), 2 (add 5). "; cin >> userInput;
if (userInput == ADD_QUARTER) { totalDeposit = totalDeposit + 25; }
/* Your solution goes here */
else { cout << "Invalid coin selection." << endl; }
cout << "totalDeposit: " << totalDeposit << endl;
return 0;}
6- Please I want answer of this question by typing. Many Thanks
Bank Muscat sends the monthly transaction report to all its customers through email. When the customer opens the file send by the bank, the customer is required to enter a valid customer ID Number. The ID Number is a six character long ending with 2 uppercase letters.
Examples of valid customer ID Numbers: 5678XY
2343WA
8987HL
Write a Pseudocode and Draw Flowchart that will:
Ask the customer to enter a valid ID Number
if customer input is “E”, allow the customer to quit the program
if the ID Number is too short, then tell the customer to renter
if the last two characters do not follow the rules, then tell the customer
allow the customer to keep entering customer ID Number.
C++ help Please!
Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followed by a newline) if the value of userItem does not match any of the defined options. For example, if userItem is GR_APPLES, output should be:
Fruit
code provided:
#include <iostream>using namespace std;
int main() { enum GroceryItem {GR_APPLES, GR_BANANAS, GR_JUICE, GR_WATER}; GroceryItem userItem;
userItem = GR_APPLES;
/* Your solution goes here */
return 0;}
Chapter 2 Solutions
Starting Out with C++: From Control Structures through Objects, Brief Version (8th Edition)
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.3 - The following C++ program will not compile because...Ch. 2.3 - Study the following program and show what it will...Ch. 2.3 - Write a program that will display your name on the...Ch. 2.4 - Prob. 2.5CPCh. 2.4 - What will the following program display on the...Ch. 2.6 - Which of the following are illegal variable names,...Ch. 2.6 - Prob. 2.8CPCh. 2.6 - Prob. 2.9CPCh. 2.6 - Prob. 2.10CP
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Which of the following is a character literal? B BCh. 2.7 - Prob. 2.13CPCh. 2.7 - Write a program that has the following character...Ch. 2.7 - What is wrong with the following program...Ch. 2.7 - Prob. 2.16CPCh. 2.7 - Write a program that stores your name, address,...Ch. 2.11 - Prob. 2.18CPCh. 2.11 - Prob. 2.19CPCh. 2.11 - Prob. 2.20CPCh. 2.14 - Is the following assignment statement valid or...Ch. 2.14 - How would you consolidate the following...Ch. 2.14 - What is wrong with the following program? How...Ch. 2.14 - Prob. 2.24CPCh. 2.16 - Prob. 2.25CPCh. 2 - How many operands does each of the following types...Ch. 2 - How may the double variables temp, weight, and age...Ch. 2 - Prob. 3RQECh. 2 - Write assignment statements that perform the...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Modify the following program so it prints two...Ch. 2 - What will the following programs print on the...Ch. 2 - Multiple Choice 9. Every complete statement ends...Ch. 2 - Prob. 10RQECh. 2 - Every C++ program must have a ________. A) cout...Ch. 2 - Preprocessor directives begin with ________. A) #...Ch. 2 - The following data 72 'A' Hello World" 2.8712 are...Ch. 2 - A group of statements, such as the contents of a...Ch. 2 - Which of the following are not valid assignment...Ch. 2 - Which of the following are not valid cout...Ch. 2 - Assume w = 5, x = 4, y = 8, and z = 2. What value...Ch. 2 - How would each of the following numbers be...Ch. 2 - The negation operator is ________. A) unary B)...Ch. 2 - A(n) ___________ is like a variable, but its value...Ch. 2 - Prob. 21RQECh. 2 - T F A variable must be defined before it can be...Ch. 2 - T F Variable names may begin with a number.Ch. 2 - T F Variable names may be up to 31 characters...Ch. 2 - T F A left brace in a C++ program should always be...Ch. 2 - T F You cannot initialize a named constant that is...Ch. 2 - Prob. 27RQECh. 2 - Convert the following pseudocode to C++ code. Be...Ch. 2 - There are a number of syntax errors in the...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 will compute the...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Average of Values To get the average of a series...Ch. 2 - Annual Pay Suppose an employee gets paid every two...Ch. 2 - Ocean Levels Assuming the oceans level is...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Cyborg Data Type Sizes You have been given a job...Ch. 2 - Miles per Gallon A car holds 15 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20-gallon...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Circuit Board Price An electronics company sells...Ch. 2 - Prob. 14PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Stock Commission Kathryn bought 750 shares of...Ch. 2 - Energy Drink Consumption A soft drink company...
Knowledge Booster
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
- Which statement reads a user-entered string into variable user_name? O O input() => user_name user_name = input() input = user_name() user_name = "input()"arrow_forward#include <iostream>using namespace std;int main(){int A, B, C, Total, Average;cout << "please enter value A:";cin >> A;cout << "please enter value B:";cin >> B;cout << "please enter value C:";cin >> C;cout << "\nInserted values: " <<endl;cout << "value A = " << A <<endl;cout << "value B = " << B <<endl;cout << "value C = " << C <<endl<<endl;Total = A + B + C;Average = Total / 3;cout<< "1. The largest value is: ";if(A > B){if(A > C)cout<< "A = " << A <<endl;elsecout<< "C = " << C <<endl;}else{if(B > C)cout<< "B = " << B <<endl;elsecout<< "C = " << C <<endl;}cout<<"2. Total value is: "<< Total <<endl;cout<<"3. Average is: "<< Average <<endl;return 0;} QUESTION 1. Explain what the program does.2. What is the outputarrow_forwardA) (Assume the user enters George Washington .)string userlnput;cout << "What is your name?";cin >> userlnput;cout <<"Hello"<< userlnput << endl;B) (Assume the user enters George Washington.)string userlnput;cout << "What is your name?";getline (cin , userlnput);cout <<"Hello"<< userlnput << endl;arrow_forward
- Integer userValue is read from input. Assume userValue is greater than 10000 and less than 99999. Assign thousandsDigit with userValue's thousands place value. Ex: If the input is 26498, then the output is: The value in the thousands place is: 6 #include <iostream> using namespace std; int main() { int userValue; int thousandsDigit; int tempVal; cin >> userValue; /* Your code goes here */ cout << "The value in the thousands place is: " << thousandsDigit << endl; }arrow_forwardUser in Below the complete statement.arrow_forward#include <iostream>#include <iomanip>using namespace std;int main(){cout << "Welcome to the Temperature Tool of Layla !\n" << endl << endl;double tf1, tf2, tf3, tf4, tf5, tf6, tf7; double tc1, tc2, tc3, tc4, tc5, tc6, tc7; cout << "Please enter 7 temperatures in Fahrenheit: " ; cin >> tf1 >> tf2 >> tf3 >> tf4 >> tf5 >> tf6 >> tf7 ; tc1=5*(tf1-32)/9;tc2=5*(tf2-32)/9;tc3=5*(tf3-32)/9;tc4=5*(tf4-32)/9;tc5=5*(tf5-32)/9;tc6=5*(tf6-32)/9;tc7=5*(tf7-32)/9;cout <<"degree F" <<setw(35) << "degree C" <<endl;cout <<fixed<< setprecision(1)<<tf1 <<setw(35)<<fixed << setprecision(1)<< tc1 <<endl;cout <<fixed<< setprecision(1)<<tf2 <<setw(35)<<fixed << setprecision(1)<< tc2 <<endl;cout <<fixed<< setprecision(1)<<tf3 <<setw(35)<<fixed << setprecision(1)<< tc3…arrow_forward
- Use c++ Create a program that ask the user for a password and verify that it meets these conditions. Password is 8 characters long, must contain 1 special symbol, non numeric value, non alphabet character, 1 upper case letter and 1 numeric characters. No restrictions on what can't be used, but please make it as simple and basic as possible. Also comment how each line works. Hardcore it as well.Please use a IDE so I can learn better. Please ensure quality is upheld. Thank you for your time.arrow_forwardCreate a flowchart that will accept three unique integers and print the sum, product and theaverage of the numbers where: A = 0, B = 0, C = 0, Sum = 0, Prod = 0, and Ave = 0. You willuse a function called COMPUTE.arrow_forwardF21. Mark whether each statement is True or False. If false, briefly state why.arrow_forward
- Please write in C#. Create an application that allows the user to input two decimal numbers. The application should also have buttons that allow the user to request that the numbers are added, subtracted, multiplied, or divided. In addition, give an option to complete all 4 calculations or to clear the input and output (i.e., reset the page to its starting state). Thank you!arrow_forwarde)1.d={0:'a',1:'b',2:'c'} 2.foriind: 3.print(i) What will be the output of this statement? A.a b c B.0 1 2 C.0 a 1 b 2 c D.None of these abovearrow_forwardGiven the following code segment, what will be the value of the variable "num5" after executing the 7th statement? If an error occurs, indicate “error”arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,