Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 10PP
Create a text file that contains the text "I hate C++ and hate
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Can you write a new code in C ++ language with the values I sent you, just like this output?
There are two files named group1.txt and group2.txt that contain course information and grades of each student for each class. I will calculate each course average for each group and show in simple bar graph. Use "*" and "#"characters for group1 and group2, respectively. I will see the number -999 at the end of each line in the input files. This value is used for line termination and you can use it to verify that you have arrived at the end of the line. The averages of each group should also be calculated and printed at the end of the file. All of the results will be printed to the file. There will be no screen output. Sample output is shown in Figure 1.
Group 1:
CSC 80 100 70 80 72 90 89 100 83 70 90 73 85 90 -999ENG 80 90 80 94 90 74 78 63 83 80 90 -999HIS 90 70 80 70 90 50 89 83 90 68 90 60 80 -999MTH 74 80 75 89 90 73 90 82 74 90 84 100 90 79 -999PHY 100 83 93 80 63 78 88…
Can you write a new code in C++ language with the values I sent you, just like this output?
There are two files named group1.txt and group2.txt that contain course information and grades of each student for each class. I will calculate each course average for each group and show in simple bar graph. Use "*" and "#"characters for group1 and group2, respectively. I will see the number -999 at the end of each line in the input files. This value is used for line termination and you can use it to verify that you have arrived at the end of the line. The averages of each group should also be calculated and printed at the end of the file.
Write a C++ program using classes that readslines from a file until the end of file. The program should prompt the user for the file name to read from. The program should open the file for reading, and if the filecannot be opened, print the message “File couldn’t be opened”, followed by a space and the filename, and exit. The program should keep track of the number of lines, the number of non-blank lines, the number of words, and the number of integers read from the file.
Chapter 2 Solutions
Absolute C++
Ch. 2 - It is difficult to make a budget that spans...Ch. 2 - You have just purchased a stereo system that cost...Ch. 2 - Suppose you can buy a chocolate bar from the...Ch. 2 - Write a program that finds and prints all of the...Ch. 2 - In cryptarithmetic puzzles, mathematical equations...Ch. 2 - Buoyancy is the ability of an object to float....Ch. 2 - Write a program that calculates the total grade...Ch. 2 - Write a program that finds the temperature, as an...Ch. 2 - (This is an extension of an exercise from Chapter...Ch. 2 - Create a text file that contains the text I hate...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Circumference and Area of a Circle) Heres a peek ahead. In this chapter, you learned about integers and the typ...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
Write a recursive method that will duplicate each character in a string and return the result as a new string. ...
Java: An Introduction to Problem Solving and Programming (8th Edition)
What are the six common steps needed to access databases from a typical program?
Modern Database Management
Write a statement that defines a file stream object named places. The object will be used for both output and i...
Starting Out with C++ from Control Structures to Objects (9th Edition)
Roman Numerals Write a program that prompts the user to enter a number within the range of 1 through 10. The pr...
Starting Out with Java: From Control Structures through Objects (7th 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
- Please help in C++ I can only make changes to the sentences.cpp file, not the ones in grey.arrow_forwardThe objective of this problem is to show that you can write a program that reads a text file and uses string methods to manipulate the text. File cart.txt contains shopping cart type data from golfsmith.com representing the gifts you have purchased for your dad for this past Fathers Day. Good for you. You have been very generous! The first item in each row of the file is the part number, the second the quantity, the third the price and the fourth the description. Your program will read the file line by line and compute the total cost of all of the items in the list. You will then display a message that looks like this, assuming the cost of each item adds up to 168.42: Here's what your output should look like: The total price for the awesome Fathers Day gifts you bought is $168.42. The shopping cart can be found here: cart.txt. Right click on the link and save the file to the folder where you have your Python files.arrow_forwardComputer Science C++ Create a text file "input.txt" with a certain amount of integers (you decide how many). Write a program that reads these numbers from the file, adds them, and when you have reached the end of the file, calculates the average of these numbers. Print a message and the average to the console. Code this program twice, demonstrating the two methods to detect the end of the file, part A: reading a value from Instream and storing it (boolean expression) in the while loop part B: using the eof() member functionarrow_forward
- Write a c++ program that reads a file consisting of students’ test scores in the range 0 – 200. It should then determine the number of students having scores in each of the following ranges: 0 –24, 25 – 49, 50 – 74, 75 – 99, 100 – 124, 125 – 149, 150 – 174, and 175 – 200. Output the score ranges and the number of students. Run your program with the following input data from file: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 157, 189.arrow_forwardWrite a C++ program that reads a file consisting of students’ test scores in the range 0 – 200. It should then determine the number of students having scores in each of the following ranges: 0 – 24, 25 – 49, 50 – 74, 75 – 99, 100 – 124, 125 – 149, 150 – 174, and 175 – 200. Output the score ranges and the number of students. Run your program with the following input data from file: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 157, 189. The program should have the following functions: • void readData – to read all input values from file. This function has three parameters: the input file variable, an array, and the size. void print – to determine and display the score ranges and the number of students. int main – to call both readData and print functions. Marks are allocated as follows: main function and prototypes void readData void printData indentationarrow_forwardI want this in pythonarrow_forward
- Write a C++ program that reads lines from a file until the end of file. The program should prompt the user for the file name to read from. The program should open the file for reading, and if the file cannot be opened, print the message “File couldn’t be opened”, followed by a space and the filename, and exit. The program should keep track of the number of lines, the number of non-blank lines, the number of words, and the number of integers read from the file.arrow_forwardWrite a C Program that allows a user to enter any number of student test scores until the user enters 999. If the score entered is less than 0 or more than 100, display an appropriate message and do not use the score. After all the scores have been entered, display the number of scores entered, the highest score, the lowest score, and the arithmetic average. Save the Project as TestScoreStatistics.cpp *Use loops and functions *Separate the implementation file from the definition file.arrow_forwardCreate a complete C++ program that will read from a file, "studentInfo.txt", the user ID for a student (a number, but use a string to hold it). Next it will need to read three integer values that will represent the 3 exam scores the student got for the semester. Once the values are read and stored in descriptive variables it will then need to calculate a weighted course average for that student. Below is an example of what the calculation would be for the program. score1 * .3 + score2 * .3 + score3 * .4 The program will then determine the letter grade for that student and write the user ID and the letter grade to a file "studentGrade.txt" The standard grading scale will be used: A --> 90 – 100B --> 80 - 89.99C --> 70 - 79.99D --> 60 - 69.99F --> below 60 To keep from the user being confused as if anything happened or not, give them a ending statement i.e. Something like the following: Program has completed and the output can be found in 'studentGrade.txt' Files…arrow_forward
- Write a program using C++ that allows you to write stats of a monster and save it to a file. Make sure the stats are in a structure. This program also allows you to open the file and read the stats of the monster. (Print what was read onto the screen -- put the values into a structure. If you put the info into the file via binary, you will need to read it via binary too.) Use the error stream (either cerr, clog, or stderr) to print out errors if the files do not open.arrow_forwardIn c++ please. Not priir code.arrow_forwardI need this code to be in pythonarrow_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
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY