in c++ input file is .txtWrite a program that asks for the name of an input file. Then, read all the numbers in the file, and display the following information to the screen:count of numbers in the filesum of all numbers in the fileaverage of all numbers in the file (to 2 decimal places)count of numbers in each range (100-199, 200-299, 300-399, etc.)The program should:display a hello messageask the user for an input filedisplay the name of the input filevalidate the file opens correctlydisplay statistical information as shown abovedisplay a goodbye message

Question
Asked Oct 17, 2019
8 views

in c++ 

input file is .txt

Write a program that asks for the name of an input file. Then, read all the numbers in the file, and display the following information to the screen:

  • count of numbers in the file
  • sum of all numbers in the file
  • average of all numbers in the file (to 2 decimal places)
  • count of numbers in each range (100-199, 200-299, 300-399, etc.)

The program should:

  • display a hello message
  • ask the user for an input file
  • display the name of the input file
  • validate the file opens correctly
  • display statistical information as shown above
  • display a goodbye message
check_circle

Expert Answer

Step 1
  • In this C++ program, Input is given using file name (xyz.txt) which contains a range of numbers.
  • Output of this program prints count of numbers, sum of all numbers, average upto 2 decimal places and count of...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Python 3.7.4 Write a for loop that prints in ascending order all the positive multiples of 5 that ar...

A: Using a for loop to print all the positive 5 multiples under 175 .For loop: It is programming langua...

question_answer

Q: In C++ programming. Below is the UAH_sample.txt The University of Alabama in Huntsville was founded ...

A: Since the program is quite complex we are answering only the first part due to lack of space, it is ...

question_answer

Q: Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a length...

A: The following is the source code for the given statements in the question.

question_answer

Q: in python   Write a Python program that uses a for loop with the range function to inspect all integ...

A: Multiples() function defines to display these two totals.

question_answer

Q: Python 3.7.4 Define a function called signOf that takes a parameter containing an integer value and ...

A: Function definition of "signOf()":

question_answer

Q: Replace any alphabetic character with '_' in 2-character string passCode. Ex: If passCode is "9a", o...

A: program to replace first 2-character by ‘_’ from the passcode.isapha() function is used for finding ...

question_answer

Q: What is the mantissa and exponent values if 6.75 is represented in 8 bit binary floating point repre...

A: Answer:Conversion of decimal to 8-bit floating point representation:Step1: convert the integer part ...

question_answer

Q: Python 3.7.4 Write the code to call a function whose name is send_number. There is one argument for ...

A: Source Codedef send_number(n):    #getting the value 5 from the function call.  print("The value of ...

question_answer

Q: in python   Write a program that prompts the user for three keyboard inputs and stores them in appro...

A: Following is the python program which takes three inputs from the user i.e. first name, last name an...