Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am new to coding and i'm very confused on this problem. please help! c++ You are to write a program to read integers from

I am new to coding and i'm very confused on this problem. please help! c++

image text in transcribed

image text in transcribed

You are to write a program to read integers from a file and print out how many numbers were in the file and the average of them. Create the following text files. Text File: data1.text (take note-there is an empty blank line at the end 45 84 75 56 78 15 28 71-5 45 Text File: data2.text (take note there is an empty blank line at the end -40 90 -19 36 82 26 -79 39 -52-42 54 62 -9 99 -37 9-99 -85 52 31 57-64 0-88 41 59-94 73 97-37 55 7472 34-40 83 7 15-72 53-65 13 65 14-76 5 -100 56 39-60 47 47 100 19 -21 46 -11 96-28 28 48 -84 -48-7 97 -35-27-6 Text File: data3.text (take note-there is nothing in the file Output #1 Enter the filename: datal.txt The numbers are: 45 84 75 56 78 15 28 71 -5 45 There were 10 numbers in the file The average was 49.20 Output #2 Enter the filename: data2.txt The numbers are: -40 90 -19 36 82 26 -79 39-52 -42 54 62-9 99-37 9-99-85 52 31-57-64 0-88 41 59-94 73 97-37 55 -74 -72 -34 -40 83 7 15 -72 53 -65 13 65 14-76 5-100 56 39-60 47 47 100 19 -21 46 -11 96 -28 28 48 -84 -48-7 97-35 -27-6 There were 68 numbers in the file The average was 1.78

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

More Books

Students also viewed these Databases questions