Question: P1- Sort strings In this problem, you will get 3 strings from the user, and alphabetically sort them. The program should then print the sorted
P1- Sort strings In this problem, you will get 3 strings from the user, and alphabetically sort them. The program should then print the sorted strings. You can assume that the given strings do not include digits or symbols. Hint: You can access characters in a string using array operators. Hint 2: You can get the length of a string using length) function. For example: string str = "mys tr"; char ch str[2] int len -str.lengthO: 1lassigns 5 to lern //assigns 's' to ch You should comply with the following constraints: Use the functions declared in the file sort.h Write the function definitions in the file sort.cpp Use the file P1.cpp for your main function You should use array operators to compare strings Your program should be named sort - - Sample Run: Please provide 3 strings zrthf absd act Sorted strings: absd act zrthf /* DO NOT CHANGE ANYTNG IN THIS FILE */ #define INPUT-SIZE 10 //You can use this for the array length //Returns true f the input integer is between the given limits bool isValid(int inVal) //Prints the distinct numbers in the array in a decreasing order void printDistinct (int numberst1) distncl h / Include libraries and header files/ //main functiorn int main() ( //variable definitions //Prompt user for integers. Check input validity using the functions in distinct.h //Print the distinct numbers in the array in a decreasing order using the functions in distinct.h return 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
