getMax function int getMax int list int n int i maxValueI
getMax function:
int getMax ( int *list, int n )
 {
 int i, maxValueIndex, maxValue;
if ( n == 0 )
 return -1;
maxValueIndex = 0;
 maxValue = list[0];
 for ( i=1; i < n; i++ ) {
 if ( maxValue < list[i] ) {
 maxValue = list[i];
 maxValueIndex = i;
 }
 }
return maxValueIndex;
 }
Solution
#include <iostream>
#include <cstring>
using namespace std;
const int MAXIMUM_LENGTH = 100;
int main()
{
char first_string[MAXIMUM_LENGTH];
char second_string[MAXIMUM_LENGTH];
cout << \"Enter first string: \";
cin.getline(first_string,MAXIMUM_LENGTH);
cout << \"Enter second string: \";
cin.getline(second_string,MAXIMUM_LENGTH);
cout << \"Before copying the strings were \";
if (strcmp(first_string,second_string))
cout << \"not \";
cout << \"the same.\ \";
strcpy(first_string,second_string);
cout << \"After copying the strings were \";
if (strcmp(first_string,second_string))
cout << \"not \";
cout << \"the same.\ \";
strcat(first_string,second_string);
cout << \"After concatenating, the first string is: \";
cout << first_string;
return 0;
}
![getMax function: int getMax ( int *list, int n ) { int i, maxValueIndex, maxValue; if ( n == 0 ) return -1; maxValueIndex = 0; maxValue = list[0]; for ( i=1; i  getMax function: int getMax ( int *list, int n ) { int i, maxValueIndex, maxValue; if ( n == 0 ) return -1; maxValueIndex = 0; maxValue = list[0]; for ( i=1; i](/WebImages/43/getmax-function-int-getmax-int-list-int-n-int-i-maxvaluei-1134867-1761607170-0.webp)
![getMax function: int getMax ( int *list, int n ) { int i, maxValueIndex, maxValue; if ( n == 0 ) return -1; maxValueIndex = 0; maxValue = list[0]; for ( i=1; i  getMax function: int getMax ( int *list, int n ) { int i, maxValueIndex, maxValue; if ( n == 0 ) return -1; maxValueIndex = 0; maxValue = list[0]; for ( i=1; i](/WebImages/43/getmax-function-int-getmax-int-list-int-n-int-i-maxvaluei-1134867-1761607170-1.webp)
