Question
Write and test a function that returns the position of the largest and smallest values in an array of double-precision numbers. ALL MY CODE HAS
Write and test a function that returns the position of the largest and smallest values in an array of double-precision numbers.
ALL MY CODE HAS TO DO IS DISPLAY THE LARGES AND THE SMALLEST VALUE. THIS IS WHAT I HAVE SO FAR, I DON'T KNOW WHAT MY MISTAKE IS. PLEASE HELP! (C++ FUNCTIONS AND ARRAYS)
#include
system("PAUSE"); return 0; } void displaymaxandmin(int arry[], int size) { double max, min; max = arry[0]; for (int i = 1; i < size; i++) if (arry[i] > max) { max = arry[i]; } cout << " Max value is : " << max << endl; min = arry[0]; for (int i = 1; i < size; i++) { if (arry[i] < min) { min = arry[i]; } }
cout << " Min value is :" << min << endl;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started