Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer requires C++ programming language. Thank you! Download numbers.txt file from Canvas, in the Lab 04 folder. The numbers.txt file contains a long list of

image text in transcribed
Answer requires C++ programming language. Thank you!
Download numbers.txt file from Canvas, in the Lab 04 folder. The numbers.txt file contains a long list of random numbers. Copy the file to your hard drive and then write a program that opens the file. reads all the numbers from the file, and calculates the followings: A) The number of even numbers in the file. B) The number of odd numbers in the file C) The sum of even numbers in the file. D) The sum of odd numbers in the file. E) The average of all even numbers in the file. F) The average of all odd numbers in the file. The program should print all the above values (A-F) in a file (inData.txt) as shown below. Number of even numbers: 99 Number of odd numbers: 101 Sum of even numbers: 49930.00 Sum of odd numbers: 55597.00 Average of even numbers: 504.34 Average of odd numbers: 550.47 Check if the input file exists and round the even and odd averages to two decimal places

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions