Question in c++ - urgent

hannach's Avatar, Join Date: Feb 2011
Newbie Member
I have a question in c++

Code:
Read the following code and answer the question bellow:                  void  main(void)
                {
                                 CMyStr* pStr = new CMyStr();
                                 CMyStr* pStr2 = NULL;
 
                                 *pStr = "aba";
                                CMyStr** ppStr = pStr;
 
                                   Print(*ppStr);
 
                                 CMyStr sName("Walla");
                                CMyStr sPosition;
 
                                   sPosition = "1";
                                CMyStr sFull = sName +  sPosition;
                                sFull += "2";
 
                                   Print(sFull);
 
                                 if(sFull.Length())
                                                 Print(sFull[0]);
 
                                 *pStr += sFull;
                                Print(*pStr);
                }
  Assume: 
        Print(char* msg)  method gets a string pointer and prints it into the screen in a new  line.


Questions:
  a. Write the CMyStr class  that was used here.
          b. What does the program output will be?
          c. Can you  think of problems in the code? If you do, please fix.
Thanks, Hanna
0
jimblumberg's Avatar
Ambitious contributor
Quote:
I have a question in c++
I don't see a question, all I see is your assignment. We will not write the code for you.

Where is the code for question a? What do you think the output will be? What problems do you see?

Jim