Answered step by step
Verified Expert Solution
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
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 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