Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2.3, Problem 2.4CP
What output will the following lines of code display on the screen?
cout << "The works of Wolfgang\ninclude the following";
cout << "\nThe Turkish March" << endl;
cout << "and Symphony No. 40 ";
cout << "in G minor." << endl;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
User Prompts
Your program will allow a human user to play Rock, Paper, Scissors with the computer. At the beginning of the game, the user should be prompted for his/her input. The valid choices for input are:• R or r (Rock)• P or p (Paper)• S or s (Scissors)• Q or q (Quit)
Beginning of Round
At the beginning of each round your program should ask the user for an input.
Invalid Entry
If the user inputs something other than r, R, p, P, s, S, q or Q, the program should detect the invalid entry and ask the user to make another choice.
Round structure
Each round of the game will have the following structure:1. The program will choose a weapon (Rock, Paper, Scissors), but its choice will not be displayed until later so the user doesn’t see it.2. The program will announce the beginning of the round and ask the user for his/her weapon choice3. The two weapons will be compared to determine the winner (or a tie) and the results will be displayed by the program4. The next round will…
| 24. Nana is evaluating four of her student programs. The program is asked to output letter
values from numeric values. The numerical value is in the range of .100 and the letter
value is between A, B, C, or D. These four programs have been tested by Nana with an
input value of = 60. As a result, the four programs output "D" as if the programs were
correct. However, ONE OF THE PROGRAMS BELOW IS WRONG! which program is it?
100 A
91
81 - 90 →B
71 - 80 →C
0 - 70 → D
Aif (num> 90):
print ("Grade A")
elif (num>80):
print ("Grade B")
elif (num> 70):
print ("Grade C")
else:
if (num>90) :
print ("Grade A")
if (num>80 and num70 and num<-80):
print ("Grade C")
else:
B
print ("Grade D")
print ("Grade D")
Cif (num<-70):
print ("Grade D")
elif (num<=80):
print ("Grade C")
elif (num<-90):
print ("Grade B")
else:
if (num<-90) :
If (num<=80) :
if (num<=70) :
print ("Grade D")
else:
print ("Grade C")
else:
D
print ("Grade A")
print ("Grade B")
else:
print ("Grade A")
Program by using C #
C sharp
My student number :1910206534
Chapter 2 Solutions
Starting Out with C++: Early Objects (9th Edition)
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...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write an IfThen statement that prints the message The number is not valid if the variable sngSpeed is outside t...
Starting Out With Visual Basic (8th Edition)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
When determining whether a number is inside a range, its best to use this operator. a. b. ! c. | | d. ? :
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
For the circuit shown, use the node-voltage method to find v1, v2, and i1.
How much power is delivered to the c...
Electric Circuits. (11th Edition)
Explain what must be done when fully replicating a database but allowing only one computer to process updates.
Database Concepts (8th Edition)
Which of the following activities require real-time processing? a. Printing mailing labels b. Playing a compute...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
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
- • Using for loop #The given word str = "Complication" #An intermediate variable to store and print the datac = "" #looping through the string to append and print successive charactersfor character in str: #Appending and printing successive charactersc=c+characterprint(c) • Using While loop #The given word str = "Complication" #An intermediate variable to store and print the datac = ""#An iterator to iterate through the stringi=0 #looping from 0 till we reach the length of stringwhile(i<len(str)): # Appending and printing successive characters c=c+str[i]print(c)# Incrementing the iteratori+=1 Create a flow chart for code.arrow_forwardPrograming C The program will ask for the information - Of the professor: Professor's ID Professor's first name (ending with a period) - For the number of TAs in the class - For TA information - First Name of the TA (ending with a period) - ID of the TA - Number of hours assigned to work for the class (this should be a decimal). - For the number of students in the class - For the students information Age ACT GPA First Name of the student (ending with a period) There is an example of how the output of the program should look like but it doesn’t have to look exactly like that. Please input professor's ID: 101566 Now, please input profesor's first name. Make sure to end with a period. Tim. ID of professor is 101566 FirstName: Tim How many TAs do you have? Input info of ta in this format: ID_hours 101655_20.0 Input ta's first name. Make sure to end with a period. Joe. Info of TA 1 is: ID: 101655 Hours: 20.00 FirstName: Joe How many students do you have? Input info of student in this…arrow_forwardcode in c++arrow_forward
- 4 -A mathematician and discovered a number which have unique properties. As he is not decided any name to that number, so for the time being we call that number ‘Cuboid’. A unique property of Cuboid is that, if we break that number into individual units like breaking 153 into 1, 5 and 3 and take their individual cube, then the sum would be the same as original number being given. Your task is to ask the user an integer and print weather the digit entered is Cuboid or not. (Python program)arrow_forwardQ5: A/ Use input function to write a computer programming to test the weather state according to a given temperature using the conditions helow : 1-x 30 hot weather. Choose one section from the following :arrow_forwardDesign c++ code for below input. Screenshot and code is mustarrow_forward
- 1. The game begins by welcoming the player and asking their name. Input verification is not needed. 2. It then displays the rules of the game and asks for a non-zero positive integer n. Your program must verify the user input. 3. Next, it repeatedly shows options to the player; a set of four quiz questions (described in the next section) and an option to quit the game. 4. The player can select any question of their choice or decide to quit the game at this point. The same question can be selected multiple times. Assignment # 2 Due: Oct 17th, 11:59 PM Page 5 of 11 5. For every question, your program must generate a random DNA strand of length n. The player must answer the selected question for this DNA. 6. The player receives points for every correct answer (see the sample output). Otherwise, they lose 1 point per incorrect answer. Your program must compute the correct answer for a question, verify the player’s answer, and award points accordingly. 7. After every attempt, your program…arrow_forward4.Rohan bought a gallon of milk with an original price of $4.25; today he gets a 15% discount before a 5% tax; display the final price of the milk.5.This function is named compound_interest, takes these arguments p r n t; compute and return a for displaya = p (1 + r/n) nt6.This function is named annuities, takes these arguments r i n; compute and return s for displays = r ((1 + i)^(n + 1))/i - rarrow_forwardi need answer very quicklyarrow_forward
- what is correct answer?arrow_forwardIZVO @ ۲:۱۰ م 50 EETE2102-Electronics-... :puäillu | E هل تريد الانضمام إلى هذا الجهاز؟ الانضمام Moodle Write a program in C that accepts: 1. the radius of a sphere in a variable say radius, 2. The choice (in a character variable choice) .If the choice is a, area of sphere should be found else the volume of the sphere should be found. area of a sphere is given by the formula: area=4 x TT x radius? and the volume of the sphere is given by the formula: volume=4/3 x radius3 Note: Create/Use appropriate header files, constants and functions Sample Output 1: Enter the radius of the sphere :1 Enter choice: a for area of sphere an Volume of sphere is 4.186667arrow_forwardQ#4: Program the following.· Prompt user to input distance in Kilometers and display it in meters.· Input any number from user and generate its square e.g. square of 8 is 64· Input any number from user and generate its cube e.g. cube of 8 is 512· Input a 4 digit number in any integer type variable and sum all the four digits, e.g. int a =3487,result = 22· Generate the table for a number input by the user.· For the following equation 3x 4 + 4x 3 + x 2 + 7x + 9, substitute the user provided value of x andgenerate the result. Language Carrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY