Implement a custom type for representing strings in C++. Allow following operations as well as operators, considering dynamic memory allocation:
Operations:
- length: determine the length of string
- upper: convert the string to upper case
- lower: convert the string to lower case
- at: return character at a given index
- substring: extract a substring given start and end
- index: find starting index of a substring
- compare: compare two strings
- concat: concatenate/append the argument after current string. Cater cases for different data types such as String, C-string, char, int, float
- prepend: concatenate/append the argument before current string. Cater cases for different data types such as String, char, int, float
Operators:
- + : for concatenation and prepend operations taking into account different data types and order of argumets
- = : for assignment
- ==, !=, < and > : for comparison operations
- [] : for access to character at a given index
- >> and << : for output and input a string
Roman Number
Implement a class to represent a Roman Number based upon the Standard Form described on the Wikipedia page (https://en.wikipedia.org/wiki/Roman_numerals). Support following operations using corresponding operators:
- + : for adding two roman numbers
- : for subtracting two roman numbers
- * : for multiplication of two roman numbers
- / : for division of two roman numbers
- ==, !=, < and > : for relational comparison of two roman numbers
- ++ and : for increment and decrement, both prefix and postfix versions
Reviews
There are no reviews yet.