Hello, I was wondering if someone could write this code for me... Write a progra
ID: 3640610 • Letter: H
Question
Hello, I was wondering if someone could write this code for me...Write a program that reads in an array of type int. It provides facility to either read an array from the keyboard or from a file, at the user's choice. If the user chooses file input, the program should request a file name. You may assume that there are fewer than 100 entries in this array. Your program determines how many entries there are. In addition, the program should also find the maximum number in the array and calculates the average of the array. You should use functions.
It would be greatly appreciated!!
Explanation / Answer
PS: Please rate the answer #include #include #include using namespace std; // Function prototypes int getLowest(int [], int); int getHighest(int [], int); int getSum(int [], int); double getAverage(int [], int); const int ARRAYSIZE = 100; //array size int main() { int number[ARRAYSIZE]; int highest, lowest, sum; //values double avg; //avg value int count = 0,i; ifstream inputFile; //open stored file inputFile.open("numbers.txt"); if (!inputFile) { cout > i) { number[count++] = i; }//end while inputFile.close(); } highest = getHighest(number, count); //get highest number and display lowest = getLowest(number, count); //get lowest number and display sum = getSum(number,count); //get sum and display avg = getAverage(number,count); //get avg and display coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.