Question: c++ code #include // Used for cin and cout using namespace std; // making life easier so that we do not need to use std::cin

c++ code
#include // Used for cin and cout
using namespace std; // making life easier so that we do not need to use std::cin , std::cout, etc.
//Write the function called locateSmallest in the given interval such that
// output : int: index of the smallest value in the array
// input : an array of int, the starting index of search, the ending point of searchspace
// function: find the location (i.e index) of the smallest value of array in the given interval
//****************To Do********************
int locateSmallest(int *array, int start, int end){
}
//Write the function called ReplaceVariable in the given interval such that
// output : you decide what is the output
// input : an array of int, the targetvalue we are searching for, an int which is the starting index of search, an int which is the ending point of searchspace
// function: Search in the array from given start to end index and replace the given target value with 1000
//****************To Do********************
//write a function called printArray to print out the elements of the give array
//output: void
//input: the array and its size
//****************To Do********************
//Write the function called sumOdds in the given interval such that
// output : integer
// input : an array of int, the starting index of search, the ending point of searchspace
// function: Sum the odd numbers in the given interval
//Hint: % is used for modulo operation. n%m gives you the remainder after dividing n to m. For example 7%3 = 1 because 7 = 3*2 + 1, then 1 is the remainder.
//****************To Do********************
int sumOdds(int *array, int start, int end){
}
int main()
{
int myarray[] = { 16, 3, 77, 40, 20, 40, 44, 40, 90 };
int target = 40;
//****************To Do********************
//calling locateSmallest on myarray from index 2 to 8
// output should be : 4
cout << "The smallest value is at the index 4, your result is "<
//****************To Do********************
//To Do: call ReplaceVariable on myarray to replace target between 3 to 7
//To Do : call the printArray on myarray
//output should be: 16 3 77 1000 20 1000 44 40 90
//calling sumOdds on myarray for 1-10
// output should be : 80
cout << "The summation of odd number in the given interval is 80, your answer is "<
system("pause");
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!