EXERCISES
All the exercises are with reference to class STRING.
- Write a program to sort an array of strings in ascending order of string length.
- Write a program to remove duplicates from an unsorted array of strings.
- Overload Unary operator ‘++’ such that all characters are changed to its uppercase equivalents.
- Overload Unary operator ‘--’ such that all the characters are changed to its lowercase equivalents.
- Develop method charAt (int n). It should return the nth character from the string.
- Write a method to check whether any white space character is present in the string.
- Write a function test to check if newline (‘\n’) character is part of a string.
- Write a method toString() to convert string object to ordinary string (C-string).
Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.