Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 4P
Modify the C++
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please use easy logic with proper indentations and comments for understanding!. Coding should be in C++. I am providing an algorithm that you will need to answer this coding question. I am also providing this solved program but it's not printing each line separately as it supposed to (Output given). The file has 3 separate lines. Our program supposed to print three separate lines as exactly shown in the sample output. Please review my code and provide a correction to it. Thank you
Answer the given question with a proper explanation and step-by-step solution.
For C++ coding
Create a program that finds the even and odd numbers between 20 to 55 (Inclusive).
(Hint: If a number is divisible by 2, it is an even number. You can check number mod 2 is equal to 0. Translate this algorithm in code)
Expected Output:
Write a program in C++ which adds, subtracts, multiplies, divides, and perform exponentiation on two specific numbers. The two numbers should be entered by the user. Each output should include a string describing what the numerical output is being displayed.
Use the switch block so that the user is able to select which mathematical function to perform. Make sure the program has a neat menu for the user to use to select their choice. Also, avoid having the computer perform a division by zero if the user attempts it by outputting a warning message in its place (You can use an if statement to execute this). Include your C++ source code as well as the output of your program in your submission
Chapter 1 Solutions
Problem Solving with C++ (9th Edition)
Ch. 1.1 - Prob. 1STECh. 1.1 - What would be the data for a program to add two...Ch. 1.1 - Prob. 3STECh. 1.1 - What is the difference between a machine-language...Ch. 1.1 - What is the role of a compiler?Ch. 1.1 - What is a source program? What is an object...Ch. 1.1 - What is an operating system?Ch. 1.1 - What purpose does the operating system serve?Ch. 1.1 - Prob. 9STECh. 1.1 - Prob. 10STE
Ch. 1.1 - Prob. 11STECh. 1.2 - An algorithm is approximately the same thing as a...Ch. 1.2 - Prob. 13STECh. 1.2 - Prob. 14STECh. 1.2 - Prob. 15STECh. 1.3 - If the following statement were used in a C++...Ch. 1.3 - What is the meaning of \n as used in the following...Ch. 1.3 - What is the meaning of the following statement...Ch. 1.3 - What is the meaning of the following statement...Ch. 1.3 - What is the meaning of this directive? # include...Ch. 1.3 - What, if anything, is wrong with the following...Ch. 1.4 - Prob. 22STECh. 1.4 - Prob. 23STECh. 1.4 - If you omit a punctuation symbol (such as a...Ch. 1.4 - Omitting the final brace } from a program produces...Ch. 1.4 - Prob. 26STECh. 1.4 - Suppose you write a program that is supposed to...Ch. 1 - Using your text editor, enter (that is, type in)...Ch. 1 - Modify the C++ program you entered in Practice...Ch. 1 - Further modify the C++ program that you already...Ch. 1 - Modify the C++ program that you entered in...Ch. 1 - Modify the C++ program that you entered in...Ch. 1 - Prob. 6PCh. 1 - Write a C++ program that reads in two integers and...Ch. 1 - Write a program that prints out C S ! in large...Ch. 1 - Write a program that allows the user to enter a...Ch. 1 - Write a program that allows the user to enter a...Ch. 1 - Write a program that inputs a character from the...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Suppose the insertion sort as presented in Figure 5.11 was applied to the list Gene, Cheryl, Alice, and Brenda....
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Explain the problems that denormalized tables may have for insert, update, and delete actions.
Database Concepts (7th Edition)
What is a PictureBox control used for?
Starting Out With Visual Basic (7th Edition)
Write an accessor method called getPrecision that can be added to the class Calculator in Listing 9.12 and that...
Java: An Introduction to Problem Solving and Programming (7th Edition)
It is a common practice in object-oriented programming to make all of a classs data attributes accessible to st...
Starting Out with Python (4th Edition)
Write a program to count blanks, tabs and newlines.
C Programming Language
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
- Write the program segment for Embarcader C++ to print the following output using Nested Loops (use English language) :arrow_forwardI am needing assistance with the following problem. Write a C++ program that reads a set of integers and then finds and prints the sum of the even and odd integers.arrow_forwardPlease use easy logic with proper indentations and comments for understanding!. Coding should be in C++. I am providing an algorithm that you will need to answer this coding question. I am also providing this solved program but it's not printing each line separately as it supposed to (Output is given in the picture). The file has 3 separate sentences on 3 lines. Our program supposed to print three separate lines as exactly shown in the sample output. Please review my code and provide a correction to it. Thank you 1 2 3 #include <iostream> 4 #include <fstream>5 #include <cstdlib>6 7 using namespace std; 8 9 void status(string st,int &vowel,int &consonant, int &other)10 {11 12 //if it is vowel13 if ((st[0]=='a' || st[0] == 'e' || st[0] == 'i' || st[0] == 'o' || st[0]=='u') || (st[0]=='A' || st[0] == 'E' || st[0] == 'I' || st[0] == 'O' || st[0]=='U') )14 vowel++; //incrementing vowels by 115 else if(isalpha(st[0]))16 consonant++;…arrow_forward
- Answer the below in c++ also please attach outputarrow_forwardWrite a program in C++ which adds, subtracts, multiplies, divides and performs exponentiation on two specific numbers. The two numbers should be entered by the user Each output should include a string describing what the numerical output is being displayed. Use the switch block so that the user is able to select which mathematical function to perform. Make sure the program has a neat menu for the user to use to select their choice. Also, avoid having the computer perform a division by zero if the user attempts it by outputting a warning message in its place (You can use an if statement to execute this). Include your C++ source code as well as the output of your program in your submissionarrow_forwardInstruction: Write a C++ PROGRAM INCLUDE THE HEADER FILE, MAIN CPP, AND BSTREE.CPP and the text file and show the output. Please Don't use AVLTree. There is a real program developed by a computer company that reads a report ( running text ) and issues warnings on style and partially corrects bad style. You are to write a simplified version of this program with the following features: Statistics A statistical summary with the following information: Total number of words in the report Number of unique words Number of unique words of more than three letters Average word length Average sentence length An index (alphabetical listing) of all the unique words (see next page for a specific format) Style Warnings Issue a warning in the following cases: Word used too often: list each unique word of more than three letters if its usage is more than 5% of the total number of words of more than three letters Sentence length : write a warning message if the average sentence length is…arrow_forward
- Write C++ code for the following programming exercises. (All inputs must be done in main(), and all four functions must be called from main()) Unfortunately I can't use more "advanced" coding techniques. I have to use functions, so I've included a sample of what the code should look similar to. I'm stuck on this and any help is much appreciated.arrow_forwardWrite a program (in C++) which acts as a four-function calculator (addition, subtraction, multiplication, and division). Your program should do the following: Output text saying this program is a four-function calculator. It should then prompt the user to input a number 1 through 4 depending on which operation they want to do. It should then prompt the user to input two numbers to operate on. The program should then do the operation internally. The program should then output result from the variable. Your program should have comments describing what the code lines do.arrow_forwardCreate a C++ program of a simple calculator using function. Note: show a screenshot with the same output on the sample outputarrow_forward
- please write c++ program to solve this problem without using array Your program will be "menu driven". This means that after every completed operation by your program, the user is presented with a menu of options once again. EVERY menu will have a "Quit" option that will exit the user completely from your program. Create your menu options with brief but meaningful labels. The first option of your program will prompt the user to enter a positive binary number (base 2 -- 1's and 0's only) of no more than 6 digits. Read this value as an int type value and your program must make sure that it is indeed a binary number (only 1's and 0's). If it isn't, then the user is prompted again. If it is binary, then your program is to calculate the equivalent decimal value (base 10 -- the number system). The second option of your program will prompt the user to enter 3 positive numbers in the range1 to 10, and will tell the user whether the three inputs will form the sides of a triangle. That is, your…arrow_forwardWrite a C++ program that prompts the user to enter the length of a triangle a,b and c. the program then calculates and prints out the triangle area, using the formula: , where . a. Design an algorithm for the problem.b. Write One complete C++ program for your designed algorithm. Attach your sample run (screenshot of your work).arrow_forwardIn C++ the rand() function is used to generate random integer but my prof has given an assignment to write a C++ program that generates a random float value in the range [0,1) having 2 digits after decimal. But he mentioned clearly to use the rand() function. Help me out.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Structured Chart; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=vdUO-sGA1DA;License: Standard YouTube License, CC-BY
Introduction to Structure Charts; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=QN2bjNplGlQ;License: Standard Youtube License