Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include using namespace std; void displaymaxandmin(int arry[], int size); int main() { int arry[10] = { 110, 20, 30, 40, 50, 160, 70, 80, 90, 100 }; displaymaxandmin(arry, 10);

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

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions