C++ Professor Gekko has always dreamed of inline skating from Detroit to Ann Arbor. The professor can carry two liters of water, and he can skate m miles before running out of water. The professor will start in Detroit with two full liters of water. His map shows the nine places along the way at which he can refill his water and the distances between these locations. Please help the professor to minimize the number of water stops along his route to Ann Arbor. You will need the following variables: ● Integer variable m that holds the distance that the professor can skate with 2 liters of water. Prompt for and get from the user a value for m. ● Integer array stops[10]thatrepresents distances between the stops. The first spot in the array (index 0) is the starting point so it will have a value of zero. Use function randomDistances (described below) to place random numbers in the array in the second through tenth spots. ● Integer variable currentStop that holds the stop that the professor is currently at.You will also need the following functions: ●voidrandomDistances(int stops[], int m) loops through the stops array and randomly generates, stores, and prints integer values between 1 and m. Remember that the first stop is zero. See sample app Arrays on Canvas for generating and storing random numbers in an array. ●int getNextStop(int stops[], int currentStop, int m) is a value function that gets the next stop where the professor will need to stop and refill his water bottle. Within each call to the function, use integer variable currentStop as the starting point in the stops array. Have the calling function (probably main) store and print the stop returned by the function.The output may look like this: Input the value of m: 10 Stop array: 0 2 8 5 1 10 5 9 9 3 Professor stops at water stop 2 Professor stops at water stop 4 Professor stops at water stop 5 Professor stops at water stop 6 Professor stops at water stop 7 Professor stops at water stop 8
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
#include<iostream>
#include<cstdlib>
using namespace std;
void randomDistances(int stopArray[], int m);
int getNextStop(int stops[], int currentStop, int m);
//function to genetrate stops using random numbers between 1 to
m
void randomDistances(int stopArray[], int m){
stopArray[0]=0;
cout<<"Stop array: ";
cout<<stopArray[0]<<" ";
for(int i=1;i<10;i++){
stopArray[i]=rand()%m+1;
cout<<stopArray[i]<<" ";
}
}
int getNextStop(int stops[], int currentStop, int m){
int distanceCovered=0;
int addDistance=0;
for(int i=0;i<=currentStop;i++){
distanceCovered+=stops[i];
}
addDistance=distanceCovered;
currentStop++;
while(currentStop<10){
addDistance+=stops[currentStop];
if((addDistance-distanceCovered)/m==1 )
break;
currentStop++;
}
if((addDistance-distanceCovered)%m!=0 )
currentStop=currentStop-1;
return currentStop;
}
//main method
int main(){
int m,i=-1;
int stops[10];
cout<<"Input the value of m: ";
cin>>m;
randomDistances(stops,m);
while(i<10){
i=getNextStop(stops,i,m);
cout<<"\nProfessor stops
at water stop "<<i<<"\n";
}
return 0;
}

Kindly revert for any queries
Thanks.
C++ Professor Gekko has always dreamed of inline skating from Detroit to Ann Arbor. The professor...
16.2-4 Professor Gekko has always dreamed of inline skating across North Dakota. He plans to cross the state on highway U.S. 2, which runs from Grand Forks, on the eastern border with Minnesota, to Williston, near the western border with Montana. The professor can carry two liters of water, and he can skate m miles before running out of water. (Because North Dakota is relatively flat, the professor does not have to worry about drinking water at a greater rate...
16.2 #4) Please answer full question thoroughly showing detailed work. SUBMIT ORIGINAL (not book solutions) work and ensure it is correct for thumbs up. If work is NOT ORIGINAL will give THUMBS DOWN!!! Professor Gekko has always dreamed of inline skating across North Dakota. He plans to cross the state on highway U.S. 2, which runs from Grand Forks, on the eastern border with Minnesota, to Williston, near the western border with Montana. The professor can carry two liters of...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
IN C++ Please!! Declare a global integer constant called SIZE and initialize it to 10. • Declare a global enum variable that will support 10 values – each representing an ant colony {A, B, C, D, E, F, G, H, I, J}. • In the main function, o Declare a 2-dimensional array of size the global integer constant, SIZE. The number of rows and columns should be equal to SIZE, which would make this a square matrix. This array will...
Assignment 5 will be way different. It will be more like what
you will receive in a programming shop. By that I mean that some
things are built for you and others you will need to create or
finish. P.S. part of your grade will include: Did you add in the
required files? Did you rename your project? does your linear
searches work? Did you put your code in the correct modules? did
you change modules that you weren't supposed...
Santa Monica College CS 20A: Data Structures with C++ Spring 2019 Name: True/False: Circle one Assignment 1 ID: 1. True / False 2. True / False 3. True / False 4. True / False 5. True / False 6. True / False 7. True / False 8. True / False 9. True / False 10. True / False Variable and functions identifiers can only begin with alphabet and digit. Compile time array sizes can be non-constant variables. Compile time array...