Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

A string in C++ is simply an array of characters with the null character(\0) used to mark the end of the string. C++ provides a set of string handling function in as well as I/O functions in . With the addition of the STL (Standard Template Library), C++ now provides a string class.

But for this assignment, you are to develop your own string class. This will give you a chance to develop and work with a C++ class, define constructors and destructors, define member functions outside of the class body, develop a copy constructor and assignment operator (and understand why!), work with C-Style strings and pointers, dynamically allocate memory and free it when done.

Of course, you must also do suitable testing which implies writing a main function that uses your new string class.

The following is the skeleton of the Mystring class declaration. Mystring.h file is provided. You must produce the Mystring.cpp and main.cpp files.

class Mystring

{

private:

char *pData; //pointer to simple C-style representation of the string

//(i.e., sequence of characters terminated by null)

//pData is only a pointer. You must allocate space for

//the actual character data

int length; //length of the string

//... //possibly other private data

public:

MyString(); //constructor --- create empty string

MyString(char *cString); //constructor --- create a string whose data is a copy of

//cString

~MyString(); //destructor -- don't forget to free space allocated by the constructor

//i.e., the space allocated for the character data

MyString(MyString const& s); //override the default copy constructor --- why?

//important -- think about it -- possible test question

MyString operator = (MyString const& s); //override default assignment operator

void Put(); //output string

void Reverse(); //reverse the string

MyString operator + (MyString const& s); //concatenation operator

// ... //other useful member functions

//as you wish

};

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93124612

Have any Question?


Related Questions in Computer Engineering

How can word processing software give a person the ability

How can Word Processing software give a person the ability to better position themself or a business, in today's society? Why?

What are the implications of the shift from medical care to

What are the implications of the shift from medical care to the focus on overall health conditions?

Identify and evaluate at least three considerations that

Identify and evaluate at least three considerations that one must plan for when designing a database. Suggest at least two types of databases that would be useful for small businesses, two types for regional level organi ...

Statistics and facts about smartphonessmartphones mobile

Statistics and facts about Smartphones Smartphones, mobile phones with more advanced computing capabilities and connectivity than regular mobile phones, came onto the consumer market in the late 90s, but only gained main ...

Junit test labyou will be creating a junit test class for

JUnit Test Lab You will be creating a JUnit Test Class for Gradebook.java, that has been provided for you.   Add a getScoreSize() method to the Gradebook class which returns scoresSize; Add a toString() method to the Gra ...

Explain that this threat represents a well-known and broad

Explain that this threat represents a well-known and broad category of electronic and human activities that breach the confidentiality of information.

System analysis and designthink about your own university

System Analysis And Design. Think about your own university or college and choose an idea that could improve student satisfaction with the course enrollment process. Currently, can students enroll for classes from anywhe ...

Say you want to match ip addresses however its likely that

Say you want to match IP addresses. However, it's likely that an invalid IP address such as 192.168.1.256 will match with your regex as well. What would you would need to do to validate that an IP address is valid, and w ...

An exam has 5 multiple choice questions with 2 possible

An exam has 5 multiple choice questions with 2 possible answers each, and 5 true and false questions. Assume each question on the test counts 10 points, and that each question has a unique answer. If a student guesses ea ...

In the scenario activity operating systems and forensics

In the scenario activity Operating Systems and Forensics, which forensic tools would you utilize to recover and process evidence found on the hard drive and what is the objective of recovering data from the USB drive tha ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As