Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6.1, Problem 3STE
Suppose that you are still writing the same
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24.
*1
*8 4
2 *6 9
8 5 *9 3
As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.
According to rules that you implemented what is the maximum sum of below input? It means please take this input (as file or constants directly inside the code) for your implementation and…
You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24.
*1
*8 4
2 *6 9
8 5 *9 3
As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.
Write code for below problem in C language
please solve this in python
Chapter 6 Solutions
Problem Solving with C++ (10th Edition)
Ch. 6.1 - Prob. 1STECh. 6.1 - Prob. 2STECh. 6.1 - Suppose that you are still writing the same...Ch. 6.1 - Prob. 4STECh. 6.1 - Prob. 5STECh. 6.1 - Prob. 6STECh. 6.1 - Suppose bla is an object, dobedo is a member...Ch. 6.1 - Prob. 8STECh. 6.1 - Prob. 9STECh. 6.1 - A program has read half of the lines in a file....
Ch. 6.1 - Prob. 11STECh. 6.2 - Prob. 12STECh. 6.2 - Prob. 13STECh. 6.2 - Prob. 14STECh. 6.2 - What output will be sent to the stuff.dat when the...Ch. 6.2 - Prob. 16STECh. 6.2 - In formatting output, the following flag constants...Ch. 6.2 - Here is a code segment that reads input from...Ch. 6.2 - Prob. 19STECh. 6.2 - Write the definition for a void function called...Ch. 6.2 - (This exercise is for those who have studied the...Ch. 6.3 - Suppose c is a variable of type char. What is the...Ch. 6.3 - Suppose c is a variable of type char. What is the...Ch. 6.3 - Prob. 24STECh. 6.3 - Consider the following code (and assume that it is...Ch. 6.3 - Consider the following code (and assume that it is...Ch. 6.3 - Suppose that the program described in Self-Test...Ch. 6.3 - Consider the following code (and assume that it is...Ch. 6.3 - Prob. 29STECh. 6.3 - Define a function called copyLine that takes one...Ch. 6.3 - Prob. 31STECh. 6.3 - (This exercise is for those who have studied the...Ch. 6.3 - (This exercise is for those who have studied the...Ch. 6.3 - Suppose ins is a file input stream that has been...Ch. 6.3 - Write the definition for a void function called...Ch. 6.3 - Consider the following code (and assume that it is...Ch. 6.3 - Write some C++ code that will read a line of text...Ch. 6 - Write a program that will search a file of numbers...Ch. 6 - Write a program that takes its input from a file...Ch. 6 - a. Compute the median of a data file. The median...Ch. 6 - Write a program that takes its input from a file...Ch. 6 - Write a program that gives and takes advice on...Ch. 6 - Write a program that reads text from one file and...Ch. 6 - Prob. 7PCh. 6 - Write a program to generate personalized junk...Ch. 6 - Write a program to compute numeric grades for a...Ch. 6 - Enhance the program you wrote for Programming...Ch. 6 - Prob. 4PPCh. 6 - Write a program that will correct a C++ program...Ch. 6 - Write a program that allows the user to type in...Ch. 6 - This project is the same as Programming Project 6,...Ch. 6 - This program numbers the lines found in a text...Ch. 6 - Write a program that computes all of the following...Ch. 6 - The text file babynames2012.txt, which is included...Ch. 6 - To complete this problem you must have a computer...Ch. 6 - Write a program that prompts the user to input the...Ch. 6 - The following is an old word puzzle: Name a common...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
How many hello output lines does this program print?
Computer Systems: A Programmer's Perspective (3rd Edition)
public class MyClassT { public static void displayValue(T value) { System.out.println(value); } }
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
The classs________ are the statements that define the classs fields, properties, and methods. a. data agents b....
Starting out with Visual C# (4th Edition)
Write out definitions for the following fields:
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
What is a class specification file? What is a class implementation file?
Starting Out with C++ from Control Structures to Objects (8th Edition)
Why is the study of database technology important?
Database Concepts (7th Edition)
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
- You are a cyber investigator, your task is to write a python program that can read file signatures from a file and save them into a list. Each file signature is an element of your list. Then, try to find out if there is a JPG file in there. If there is a JPG file, print out a True on screen. (File Signature for JPG file is: FF D8 FF DB) The input file is: FSCS360_Midterm_Exam_Part2.txtarrow_forwardWrite code for below problem. The input below is just an example and you should implement independent from the input. You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24. *1 *8 4 2 *6 9 8 5 *9 3 As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.arrow_forwardTake a sufficient sample of Gutenberg's couple of digital books of your choice. Create (random?!) samples of 200 partitions of the book. Make sure each partition or record has 100 words. Generalize the program so that you can replicate that for multiple books. Maintain the label for each of the text segments or records or document, label them as a, b and c etc. as per the book they belong to. Use Regular Expressions and Pandas to manipulate the data and serialize them.arrow_forward
- Write a program that will open the file dataFile.csv, read its contents and print them out. Your output should look like this: First Last Age Wagejane Smith 21.00 21.50Jack Jones 20.00 19.50Edgar Martinez 22.00 22.75Zanab Sayegh 21.00 21.75 Could I get help doing this code in python. I can't put the file here but I put a screenshot of it in the images below. If I'm missing more details let me know. Thanks.arrow_forwardI have 200 .wav audio files each several minutes long. I want a python code to loop through the files and split each file into different 0.5 seconds .wav audio files and store the split files in a different folder. If a file is less than 0.5 seconds, then it should skip that file and continue with the loop for splitting.arrow_forwardI have managed to get my random number generator working. The range of the random number and how many random numbers are read in from a file and I can read them with no problem The generated random numbers are written to a file with the sum of those numbers. My issue is that everytime only the first line is correct, the following lines have the correct random numbers but the sum is totally wrongarrow_forward
- Answer All the questions. Make sure your answers are short and precise. You can use (Q1.txt or Ed) files to check your answers for Q1. 1. The phone numbers collected from questionnaire is a mess. Design a regular expression to filter out those numbers that are stored in the standard format "+00-0-0000-0000" from the file called "Q1.txt" and redirect the results to the "cleaned.txt". +61392144979 +61 3 9214 4778 +61-3-9214-4980 +66(2)51574430 +61-3-9285-7706 Note: Only +61-3-9214-4980 and +61-3-9285-7706 are the valid results.arrow_forwardFirst, take your program and add one more feature: at the end, just before you close the file, write the word “END” all by itself on a line. Run that program once to create a file of items with “END”. Instead of reading from cin and writing to a file, you read from your file and write to cout. The only tricky part is deciding when to stop reading. In your previous code, you stopped reading when the user said they didn’t want to continue. For the new code, keep reading until you read “END” for the name of the produce. You can use “==” on strings, so if (product name == ”END”) will tell you that you can stop reading. My code: #include<iostream>#include<string.h>#include<fstream>using namespace std; int main(){ string filename; cout<<"Enter the name of the file to store the information"<<endl; getline(cin,filename); ofstream fileptr(filename.c_str()); if(!fileptr.is_open()) { cout<<"Couldn't open a file"<<endl; }…arrow_forwardNEED HELP PLEASE! Write a Java program to read a text file (command line input for file name), process the text file and perform the following. Print the total number of words in the file. Print the total number of different words (case sensitive, meaning “We” and “we” are two different words) in the file. Print all words in ascending order (based on the ASCII code) without duplication. Write a pattern match method to find the location(s) of a specific word (a character string up to twelve characters, e.g. system). This method should return all line number(s) and location(s) of the word(s) found in the file. Print all line(s) with line number(s) of the file where the word is funds by invoking the method of 4). Under each output line indicate the location(s) of the first character of the matched word (refer to the output example below). Empty lines are lines, they also have their own unique line numbers. Repeat the pattern match (4 and 5 above) until user types in EINPUT. A word is…arrow_forward
- Use " JAVA programming" Don't provide wrong solutionarrow_forwardMatlab Exercise: Create a wav file of your own voice by reading and recording the letters A, B, C and D. (You may use the application 'audacity' for this purpose Read the file from matlab. Find out the size of the matrix. Plot the wave file. Find out the length of recording from the plot. Play the sound file from matlab Work on the matrix so that the letters B and D will he audible on one track only while playing Work agaitn on the matrix so that the letters B and D are elitminated cumpletely from the wave file. In MATLABarrow_forwardIn this and the following two exercises (8.10 and 8.11), you will carry out some simple processing on data in a file. Each line of the file has two integer values separated by a comma; there are no spaces. The first value is the weight of an individual (in pounds) and the second value is the height of the individual (in inches). The aim of the exercise is to construct a program that will compute the average weight and height. The name of the file is "data.txt". The data file looks as follows: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 Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License