C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 2PP

(Data processing) a. Store the following data in a file, or use the numbers.dat file provided on this book’s Web site.

5 96 87 78 93 21 4 92 82 85 87 6 72 69 85 75 81 73

b. Write a C++ program to calculate and display the average of each group of numbers in the file created in Exercise 2a. The data is arranged in the file so that each group of numbers is preceded by the number of data items in the group. Therefore, the first number in the file, 5, indicates that the next five numbers should be grouped together. The number 4 indicates that the following four numbers are a group, and the 6 indicates that the last six numbers are a group. (Hint: Use a nested loop. The outer loop should terminate when the end of file has been encountered.)

Blurred answer
Students have asked these similar questions
(python) Write a function sum_file(f) that takes a filename f. Each line in f contains a single number. You should write to the last line in the file the sum of all the numbers written in the file.
Instructions(C++) Write a 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: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189
(C ONLY) The program expects the name of an input file and an output file to be given by the user. If the user does not input any names, default file names should be used, such as input.txt and output.txt. The input files have lines which look like this: 3 Tester College; 1909 33001 The first number represents the rank; it is followed by the school name, year founded, and approximate number of students. Read the list of colleges into an array of structures. You may assume that the maximum size of a college name string is 64. The program should use either the insertion sort algorithm or the selection sort algorithm to sort the array in descending order by rank. Display any k consecutive schools requested by the user. For instance, if the user enters 12, the program displays the first 2 schools in a readable format of your choice. If the user enters 15, the program displays the first five schools, if the user enters 2 7, display 7 schools beginning with the one at index 1 (2 - 1), and so…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License