Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define an ordinary function called DisplayMin that has three parameters: the first two parameters are parallel arrays of different types and the third argument is

Define an ordinary function called DisplayMin that has three parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMin must work when called with various types of actual arguments, for example string DisplayMin(string names[], int calories[], int size) or int DisplayMin(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with the string array and int array, index 3 of the string array would have some name, and index 3 of the int array would have an associated value to that name (say, number of calories).)

Write one function that will take either set of arguments in, displays and return the value from the first array corresponding to the min value from the second array, in the form The min value of belongs to .

Test your function by calling it with different inputs from a main() function and then printing the result of the function in the main program.

Examples:

Given:

names => string[] = {French Fries, Cheeseburger, Hamburger, Soda, Coffee}

calories => int[] = {300, 650, 550, 450, 50}

size => int = 5

Output:

The min value of 50 belongs to Coffee.

Given:

calories => int[] = {300, 35, 650, 550, 450, 50}

prices => float[] = {2.99, .99, 2.79, 3.19, 1.79, 2.15}

size => int = 6

Output:

The min value of 35 belongs to 0.99.

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

What do you think of the MBO program developed by Drucker?

Answered: 1 week ago