Develop your own string class

Assignment Help Computer Engineering
Reference no: EM132137147

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

};

Reference no: EM132137147

Questions Cloud

The risks associated planned procurement approach : Identify the risks associated planned procurement approach. how procurement risks for this project will be monitored and controlled.
Annual holding and setup costs : The soft goods department of a large department store sells 175 units per month of a certain large bath towel. annual holding and setup costs?
What is the complexity of any dynamic programming approach : What is the complexity of any dynamic programming approach based on parts a) and b), assume that s and t are of length a and b. Use Big Omega notation
Print the converted sentence both to the screen : Print the converted sentence both to the screen and to an output file. Your input file consists of a variable number of records.
Develop your own string class : Develop and work with a C++ class, define constructors and destructors, define member functions outside .
Which of the following statements will display a string : Which of the following statements will display a string as "Jones, Jane" (the last name, a comma, a space, and the first name) in the lblFullName control?
Write a method with an input variable : Write a method with an input variable (string type). The method should return the number of uppercase letters of the input variable.
Write a query that satisfies the given requirements : Write a query that satisfies the given requirements by making sure to use GROUP BY and HAVING clauses.
Prompts the user to input the shipping cost per liter : Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylinderical containers.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a program to test the effectiveness of these algorithm

Write a program to test the effectiveness of these algorithms. Create 100 jobs, each with a random processing time of 0 to 100 time units.

  Describe simplex half-duplex and full-duplex transmission

Describe simplex, half-duplex, and full-duplex transmission and compare them in terms of cost and effective data transfer rate.

  What is the time for one double-and-add operation

Illustrate how the algorithm works for a = 19 and for a = 160. Do not perform elliptic curve operations, but keep P a variable.

  Write the xhtml to create a field set and legend with text

Write the XHTML to create a field set and legend with the text Shipping Address around following form controls: AddressLine1, AddressLine2, City, State and ZIP.

  Create static method which takes an integer as an argument

Create a static method named IsEven() which takes an integer as an argument and returns true if the argument is an even number, and false otherwise.

  Question1 write down an application named coins that asks

question1. write down an application named coins that asks user to enter one integer representing a monetary value in

  Write a simplecalculator class that has public methods

Write a SimpleCalculator class that has public methods for adding, subtracting, multiplying and dividing two doubles.

  How this technology can be used effectively in a business

Describe how this technology can be used effectively in a business setting. Are there any drawbacks to using social networks in a business setting?

  Discuss perform end-to-end stream integrity

Why is it necessary to perform end-to-end stream integrity in addition to TLS between routers

  Determine maximum frequency at which n-bit counter operate

A flip-flop has a p ns delay from the clock transition until its output changes. Assume a gate delay of g ns for each gate used in the circuit.

  Analyze the frequency distributions of common function

In 1960s, statistician Mosteller and Wallace analyzed the frequency distributions of common function words in the Federalist Papers, and drew their conclusions.

  Write a hangman game that reads words stored in a file

Write a hangman game that reads words stored in a file into an array. Use the attached file named hangman.txt.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd