Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++, we have to write functions for the code given below and other instructions for it to compile. I am having issues understanding how to

c++, we have to write functions for the code given below and other instructions for it to compile. I am having issues understanding how to confront the problem and how to write functions and read the program so it can eventually be solved so it can be compiled
image text in transcribed
image text in transcribed
image text in transcribed
7/ * INSTRUCTIONS: Write two functions in the space // * indicated below. // * // * #1 => Find index of maximum value: Write a function that will // * find the INDEX of the FIRST INSTANCE of the maximum value // * in the array. There may be more than one copy of the maximum // * value so just pass back the first index found. // * // * #2 => Insert a given number before the first maximum: Find the // * first instance of the maximum and insert a passed in number // * BEFORE this element. Do not delete any elements in the array, // * or change the order of any elements in the array. // * II * NOTE: The first function can be used with the second function. // * //* // * keep in mind that I will ONLY BE // * USING YOUR FUNCTIONS by copying it to another // * main.cpp file (with different variable values), /* for grading. So don't code to the given data, * values or expect your code outside your functions * to copy over. * Do not use global variables/constants * or goto's in your code. * Don't ask the user for information. The main * function will get all information needed and pass it * into your functions (see main function for * how your functions will be called). * three example runs are below: FIRST EXAMPLE BEFORE 1 6 2 -16 -16 2 -5 200 Index of maximum: 7 Number to Insert: 888 AFTER 1 6 2 -16 -16 2 -5 200 Index of maximum: 7 Number to Insert: 888 AFTER 1 6 2 -16 -16 2 -5 888 208 SECOND EXAMPLE BEFORE 3 -4 1 3 -4 2 Index of maximum: @ Number to Insert: 999 AFTER 999 3-4 1 3 -4 THIRD EXAMPLE BEFORE 1 140 32 3 140 21 Index of maximum: 1 Nu ber to Insert: 333 AFTER #include using namespace std; 14 PLEASE PUT YOUR FUNCTIONS BELOW THIS LINE 71 END OF FUNCTIONS void printArray(int array[], int count) > number insertNumber(array, count, number); cout

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 Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions

Question

RP-13 What does SQ3R stand for?

Answered: 1 week ago