Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ (Sum, average, and sort in ascending order and replace) Suppose that a text file numbers.txt (please download the file by clicking the link)

In C++

(Sum, average, and sort in ascending order and replace) Suppose that a text file numbers.txt (please download the file by clicking the link) contains thousands of integers. Write a program that reads the integers from the file, and displays their sum, average, and sort the integers in ascending order, and writes the sorted numbers in a file.

Please use a function to sort the integers in ascending order, such as void selection_sort(vector& v);

Write a program that

1) prompts the user to enter the file name, and display the sum, average, and the number of integers contained in the file,

2) sort the integers in ascending order,

3) and write the sorted integers in the file.

Here are the sample runs:

Please enter the file name: numbers.txt

The number of integers: 4856

The sum of integers: 3998660

The average of integers: 823

The sorted number are stored in sorted_numbers.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

What are due process and stare decisis, and why are they important?

Answered: 1 week ago