Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5 : 2 3 In this assignment, you will continue to work on the myString class from Assignment 2 . You may start with the

5:23
In this assignment, you will continue to work on the myString class from Assignment 2. You may start with the posted solution for Assignment 2 if you wish.
Functionalities
In addition to the functionalities provided in Assignment 2, you should also provide the following methods. Here, "current string" refers to the string that the method is called with. I.e. in s.length(), s is the "current string."
char& operator [](int i): returns a reference to the i th character. Also provide a version which returns a reference to a constant. They should replace the corresponding at () from the previous assignment.
myString& operator+=(const myString& s): concatenates s to the current string. The current string is modified and a reference to it is returned.
myString operator+(const myString& s): returns a new string which is the current string concatenated with s. The current string is not modified.
bool operator==(const myString& s): returns true if the two strings are equal, false otherwise.
bool operator(const myString& s): returns true if the current string is lexicographically smaller than s, and false otherwise. "Lexicographically smaller" means that "appears earlier in a dictionary." For example, "abc" is lexicographically smaller than "adc," and "he" is lexicographically smaller than "hello."
The remaining comparisons: !=,=,>,>=. Hint: use the two operators above.
Also, provide the following friend functions:
1
operator>>, operator: reads and writes into strings. For reading, note that you should ignore all whitespaces, and then read until the first whitespace. Use isspace in
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Define a performance management system.

Answered: 1 week ago

Question

Define and measure service productivity.

Answered: 1 week ago