Question in c++ - urgent

Newbie Member
4Feb2011,17:23   #1
hannach's Avatar
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
Ambitious contributor
5Feb2011,00:28   #2
jimblumberg's Avatar
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