View the step-by-step solution to:

Question

Hi tutor

second week c++ (dont use too much advanced concept)

Q:

Given an array of integers, using a function to determine its maximum and minimum elements and then return their sum. Your function must call separate functions to identify the maximum and minimum elements. If the length is 0 or negative each function must return -1 as its result.


Signature: int sum_min_and_max(int integers[], int length)


Signature: int max_integer(int integers[], int length)


Signature: int min_integer(int integers[], int length)

Top Answer

View the full answer
Screenshot_1.png

Maximum integer in an array: 19
Minimum integer of an array: 1
Sum of minumum and maximum of an array: 20

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online