Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please only FIX where I went wrong so that the correct output is given, do not redo the whole question. Also, please use very BASIC

Please only FIX where I went wrong so that the correct output is given, do not redo the whole question. Also, please use very BASIC level C++ programming like that used in my sample input.

image text in transcribed

image text in transcribed

image text in transcribed

PPLcdbfhbsdjfvfdvimage text in transcribed

1 /Includes and Define Max Array Sizd 2 #include #include 4 #define MAN 100 5 6 Prototype functions 7 loat arithmetic(floatx, int n)5 8 float geometric(float*x, int n)j 9 float harmonic(float*x, int r) 10 11 //Open Program 12 int main(void) 13 14 15 16 17 18 19 20 21 Declare Variables float x[MAXN]; float aavg, gavg, havgj int n-0; Declare and Open FILES FILE*finfopen( "samples.txt", "r"); FILE fout-fopen( "samplesout.txt", "W") / Read values into x using a while Loop while(fscant(fin, "%f", &x(n)) !-EOF){ 23 24 25 26 27 28 29 30 31 32 Call the three functions aavg arithmetic(x, n); gavg - geometric(x, n); havg-harmonic(x, n); Print the results to the Output FILE fprintf(fout, "arithmetic average n", aavg)5 fprintf(fout, "geometric average-%f ", gavg); 34 35

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago