A class SwapSort has been defined to perform string related operations on a word input. Some of the members of the class are as follows:
Class name: SwapSort
Data members/instance variables:
wrd: to store a word
len: integer to store the length of the word
swapwrd: to store the swapped word
sortwrd: to store the sorted word
Member functions/methods:
SwapSort(): default constructor to initialize data members with legal initial values
void readword(): to accept a word in UPPER CASE
void swapchar(): to interchange/swap the first and last characters of the word in ‘wrd’ and stores the new word in ‘swapwrd’
void sortword(): sorts the characters of the original word in alphabetical order and stores it in ‘sortwrd’
void display(): displays the original word, swapped word and the sorted word Specify the class SwapSort, giving the details of the constructor(), void readword(), void swapchar(), void sortword() and void display(). Define the main() function to create an object and call the functions accordingly to enable the task.