Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that searches a 5X1 integer array and finds themaximum value. Th

ID: 3615707 • Letter: W

Question

Write a program that searches a 5X1 integer array and finds themaximum value. The program should be set up as follows (noticeI don’t require any functions be used. You may use themif you wish):

1.      Fill the array by reading the 5values from a data file.

2.      Find the maximum value of thearray.

3.      Display the maximum value andthe array (as a 5X1).

Test your program using the following data:

Run 1: 19                 Run 2:   16.8

24                               13.2

            1                                  20

            10                                 12.7


#include <iostream>
using namespace std;
#include <fstream.h>
ifstream datain;

int main()
//variables
{float data[5],max;
int i;
i=0;
//data input
datain.open("somefilename.cpp",ios::in);
for(i=0;i<=4;i++)
{datain>>data[i];
cout<<data[i]<<" ";
}
datain.close();

//output
max=data[0];
for(i=1;i<=4;i++)
{if (max<data[i])
    {max=data[i];
    }
}
cout<<"the max is "<<max<<" ";

system("pause");
}

Explanation / Answer

Dear...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote