Question: (Exercise 2) Create - checkArray.cpp In this part of the lab, you will create a function checkArraySort that checks if an array of strings (which



(Exercise 2) Create - checkArray.cpp In this part of the lab, you will create a function checkArraySort that checks if an array of strings (which was previously defined and initialized) is already sorted, and it is either increasing or decreasing. The function that you create is declared as follows: - Input arguments: - A string array A (remember that array is a pointer in this case, so use the sign) - an integer variable array_size for the number of elements in array A (the counter value from previous exercise) - Return in integer value: - - 1 if the array is sorted in descending order 0 if the array is not sorted - 1 if the array is sorted in ascending order You can modify the main program that you developed in filelO.cpp to call checkArraySort, and to print out one of the following statements: - If -1 "The array is sorted in descending order!" - If 0 "The array is not sorted!" - If 1 "The array is sorted in ascending order!" You can use the same words_in.txt to test your program. Note: In order to check the sorting of strings / words, you can use the comparison operators (,>=) the same way you would compare numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
