C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 4, Problem 4.32E
What’s wrong with the following statement? Provide the correct statement to accomplish what the programmer was probably trying to do.
cout << ++(x+y);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(java programming language)
Write a Java program to do the following task:
Assign your id number (2017296004) to an integer variable id_num
Using reminder operator % on the id_num get the last 2 digits (04) and store it in num
If the num is between 0 and 30 (both included), display “You are in Group 1”
Otherwise if the num is between 31 and 60 (both included), display “You are in Group 2”
Otherwise (num is between 61 and 99 (both included), display “You are in Group 3”
Save your file as Q2.Java and upload it.
(java programming language)
Write a Java program to do the following task:
Assign your id number (example.. 2014299123) to an integer variable id_num
Using reminder operator % on the id_num get the last 5 digits (99123) and store it in num
If the num is between 0 and 30,000 (both included), display “You are in Group 1”
Otherwise if the num is between 30001 and 60,000 (both included), display “You are in Group 2”
Otherwise (num is between 60,001 and 99,999 (both included), display “You are in Group 3”
Save your file as Q2.Java
Please review the image below. Produce the program in C++. Upload screenshots of Code and Output, as well as the source code.
6
Chapter 4 Solutions
C++ How to Program (10th Edition)
Ch. 4 - (Correct the Code Errors) Identity and correct the...Ch. 4 - (What Does this Program Do?) What does the...Ch. 4 - For Exercises 4.13—4.16, perform each of these...Ch. 4 - For Exercises 4.13—4.16, perform each of these...Ch. 4 - For Exercises 4.13—4.16, perform each of these...Ch. 4 - For Exercises 4.13—4.16, perform each of these...Ch. 4 - (Find the largest) The process of finding the...Ch. 4 - (Tabular Output) Write a C++ program that uses a...Ch. 4 - (Find the Two Largest Numbers) Using an approach...Ch. 4 - (Validating User Input) The examination-results...
Ch. 4 - (What Does this Program Do?) What does the...Ch. 4 - (What Does this Program Do?) What does the...Ch. 4 - (Dangling-else Problem)C++ compliers always...Ch. 4 - (Another Dangling-else Problem) Based on the...Ch. 4 - (Another Dangling-else Problem) Based on the...Ch. 4 - (Square of Asterisks) Write a program that reads...Ch. 4 - (Palindromes) A palindrome is a number or a text...Ch. 4 - (Printing the Decimal Equivalent of a Binary...Ch. 4 - (Checkerboard Pattern of Asterisks) W rite a...Ch. 4 - (Multiples of 2 with an Infinite Loop) write a...Ch. 4 - (Calculating a Circle’s Diameter, circumference...Ch. 4 - What’s wrong with the following statement? Provide...Ch. 4 - (Sides of a Triangle) Write a program that reads...Ch. 4 - (Sides of a Right Triangle) Write a program that...Ch. 4 - (Factorial) The factorial of a nonnegative integer...Ch. 4 - (Modified Account Class) Modify class Account...Ch. 4 - (Enforcing Privacy with Cryptography) The...Ch. 4 - (World Population Growth) World population has...
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
- Fix any errors that you find. Use in-line comments to explain how and why you fixed the bugs. Test your program. If you found and fixed all the errors, your code should function as specified: The code should allow users to enter basic, one operator arithmetic expressions using integers or doubles. Then, it should calculate the result of the expression and output the results. For example, if the user inputs “2 + 2,” the calculator should output “2 + 2 = 4.” The operations the program should perform are addition (+), subtraction (-), multiplication (*), and division (/). The user should be asked whether they wish to continue after evaluating each expression. If the user types “Y” or “y,” the program should ask for a new arithmetic expression. If the user types “N” or “n,” the program should terminate with the message: “Program Finished.”arrow_forwardI need help with this problem. Please help me, because I do not understand. if 14 > 7: print("Greater than 14") x = 2 print(x * 7) else: print("Less than") print(7)arrow_forwardI need help with an assignment that deals with converting characters stored in a character array to all uppercase or all lowercase in C++. The textbook is Programming Logic and Design, Comprehensive 9th Edition (ISBN 978-1-337-10207-0). The following is the code that I have so far, and I would like to know what I am doing wrong: // ChangeCase.cpp - This program converts characters to lowercase and uppercase. // Input: Interactive // Output: Uppercase and lowercase versions of the user-entered string #include <iostream> #include <string> using namespace std; int main() { const int LEN = 9; char sample1[LEN]; char sample2[LEN]; char result1; char result2; int i; cout << "Enter 9 lowercase characters: "; for(i = 0; i < LEN; i++) { cin >> sample1[i]; // Convert sample1[i] to uppercase and assign it to result1 sample1[i] = toupper(sample1[i]); sample1[i] = result1; cout << result1 <<…arrow_forward
- Show the value of x after each of the statements is performed: x = fabs(-6.4);arrow_forwardThe correct statements are: For L = 0, L* = {e} For L = {e}, L* = {e} OL+ = LL* L* = LL+arrow_forward3. Can you please develop the code accordingly? It's not that long, I believe (relatively easy). Thanks in advance!arrow_forward
- use c# You are given two dices. Each dice has 6 faces and can generate a number between 1 and 6. The minimum number generated by the two dice is 2 and maximum number is 12. Throw the dice and if the number generated is less than 7 than you lose and if it is greater or equal to 7 than you win. You will make use of Random function and a selection structure (if/else) to write the code.arrow_forward"NEED ONLY CODE NO EXPLANATION" Harry has a big wall clock, that got hit while he was playing. Now, the minute hand doesn't rotate by the angle 2π/3600 each second, but now it moves according to different angle x. You can assume that coordinates of the centre of the clock are (0, 0) and the length of the minute hand is l. One endpoint of the minute hand is always located at the clock centre; the other endpoint is initially located at the point (0, l). One second later, Harry observes that this endpoint is at distance d above the x-axis, i.e., the y-coordinate of this endpoint is equal to d. Harry is curious about where the minute hand will be (specifically, its y-coordinate) after t seconds. Because t can be very large, Harry can't wait for that moment. Please help him to write a python code that prints a single line containing the output. Input: 4 2 2 Output 4arrow_forward(Algebra: solve 2 x 2 linear equations) You can use Cramer's rule to solve the following 2 X 2 system of linear equation: ed – bf ax + by = e cx + dy = f af - eс y ad – bc %3D ad – bc Write a program that prompts the user to enter a, b, c, d, e, and f, and displays the result. If ad – bc is 0, report that "The equation has no solution."arrow_forward
- What is the difference between the statements continue and break?arrow_forwardCorrect the following wrong statements. All binary operators except for the assignment operators are evaluated as user intention.arrow_forwardI would appreciate your help. I attached instructions to a C program. Could you copy and paste the code please?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
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,
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License