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
};
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.
|