Number Analysis
Write a program that asks the user for a file name. Assume the file contains a series of numbers, each written on a separate line. The program should read the contents of the file into an array then display the following data:
• The lowest number in the array
• The highest number in the array
• The total of the numbers in the array
• The average of the numbers in the array
If you have downloaded this book’s source code, you will find a file named numbers, txt in the Chapter 07 folder. You can use the file to test the program.
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Using MIS (10th Edition)
Concepts Of Programming Languages
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with Python (4th Edition)
C How to Program (8th Edition)
- (Statistics) Write a program that includes two functions named calcavg() and variance(). The calcavg() function should calculate and return the average of values stored in an array named testvals. The array should be declared in main() and include the values 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, and 73. The variance() function should calculate and return the variance of the data. The variance is obtained by subtracting the average from each value in testvals, squaring the values obtained, adding them, and dividing by the number of elements in testvals. The values returned from calcavg() and variance() should be displayed by using cout statements in main().arrow_forward(Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays so that a customer’s record can be accessed randomly by account number. Create the file by entering five customer records, with each record consisting of an integer account number (starting with account number 1000), a first name (maximum of 10 characters), a last name (maximum of 15 characters), and a double-precision number for the account balance. After the file is created, write a C++ program that requests a user-input account number and displays the corresponding name and account balance from the file.arrow_forwardC++ language Write a program that asks a user to input 10 numbers. The numbers are stored in the array if itis not Odd and not already available. After creating the array, it asks the user to enter a numberand deletes it from the array.arrow_forward
- Assuming an application has an array of integers named intNumbers, write code that writes the contents of the array to the file numbers.txtarrow_forwardProgramming language: C/C++, Java, Python, or any other advanced programming languages Project Description: the file “IntegerArray.txt” included in this project folder contains all the 100,000 integers between 1 and 100,000 (inclusive) in some order, with no integer repeated. Your task is to compute the number of inversions in the file given, where the i-th row of the file indicates the i-th entry of an array. Because of the large size of this array, you should implement a divide-and-conquer algorithm.arrow_forwardMulti Dimensional Activity Client Requirement: The customer wants a program that will ask the user to enter 2 numbers. these numbers will then be stored in the first two columns. the cycle will repeat until the 5 by 2 array will be completed. then the values will be prompted for checking.arrow_forward
- Use C++ This program will read the contents of a file into an array and calculate various values based on the contents of the file. The program will make use of a two dimensional array that has 30 rows and 5 columns. You will be reading in the contents from a file. You will need to read the file name from cin. You will prompt for the file name with the prompt: Enter input file name The file will consist of up to 30 sets of 5 values. The values will all be double floating point values. readFile function One function you will be required to have is called readFile. This function will read the input file. Each read will read in 5 columns of information into the next available row in the two dimensional array. The first 5 values are read into row 0, the next 5 values will be read into row 1, and so on up to 30 rows of input. You will need to keep track of how many rows of input you have read in. This could be anywhere from 0 to 30. If there are more than 30 rows of input you should only…arrow_forwardC programming c languagearrow_forwardC++ Languagearrow_forward
- An array is a group of random memory locations that all have different data type Select one: True O Falsearrow_forwardProgramming Language: C++ Please use the resources included and provide notes for understanding. Thanks in advance. Code two functions to fill an array with the names of every World Series-winning team from 1903 to 2020, then output each World Series winner with the number of times the team won the championship as well as the years they won them. The input file is attached, along with the main function and screenprint. Please note team names that include two words, such as Red Sox, have an underscore in place of the space. This enables you to use the extraction operator with a single string variable. The following resources are included: Here is main. #include <iostream>#include <fstream>#include<string> using namespace std; // Add function declarations and documentation here void fill(string teams[], int size);void findWinner(string teams[], int size); int main(){ const int SIZE = 118;int lastIndex;string team[SIZE]; fill(team, SIZE);findWinner(team, SIZE); return…arrow_forwardAll code in JAVASCRIPT Write a program that creates two files with the names file4 and file4a two 10 element int arrays with the names arrfile4 and arrfile4a; these arrays are to have different values write the contents of arrfile4 to file4write the contents of arrfile4a to file4aarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT