Reference no: EM132137993
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 <string.h> as well as I/O functions in <iostream>.
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
};
In addition, prepare a graphical explanation of each of your member functions. (Pseudo code or flowchart or some diagram to show your design.)
Evaluate the limitations of network-based defensive tools
: Evaluate the limitations of three network-based defensive tools. Based upon your evaluation, provide plausible explanations of how the hackers avoided detection
|
What are the main things to remember about elasticity
: What are the main things to remember about elasticity, supply and demand, tax incidence, government controls on the market, and economic theories?
|
Write a function obenglobish that takes an english word
: Write a function obenglobish that takes an English word and returns its Obenglobish equivalent, using the translation rule given above.
|
How many bytes does this string take in the memory
: If a string is stored at the memory address 0 times 20008000 and the string is "Cortex-M", show the memory content in hex format starting at 0 times 20008000.
|
Define constructors and destructors
: Define constructors and destructors, define member functions outside of the class body, develop a copy constructor and assignment operator.
|
How can an analyst identify appropriate sample distributions
: Having a strong statistical picture of data is important to being able to properly identify trends in statistical analysis.
|
Create a program called lastnomeupanddown take a string
: Create a program called lastnomeupAndDown take a string input from the user and print out that will substrings of increasing length.
|
Design your method so that it works quickly even
: Design your method so that it works quickly even if k is greater than the length of s, maybe even as large as +1,000,000,000.
|
Write a loop that will display the students that have
: Write a loop that will display the students that have "A" or "B" next to their names. If the stuent has a "A" next to their names, cout "Good".
|