Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is an exercise about C++ programing?partial answer is OK.It is better to add some explanations with answer?Thanks a lot. Exercise C: The DynString class
This is an exercise about C++ programing?partial answer is OK.It is better to add some explanations with answer?Thanks a lot.
Exercise C: The DynString class This is an in-lab exercise Part one What to do: Download the files DynString.cpp, DynString.h, partl.cpp from D2L Read the file partl.cpp. Try to visualize what the program will do, including calls to constructors and the destructor. Build an executable using part1.epp and DynString. cpp and run it to see what it does. Make a memory diagram for points-one, labeled in the function truncate. Also answer the following questions At point two in the main function, how many times the constructor and how many times the destructor of the class DynString is called? . . At the end of the main (just before main function terminates), how many times the constructor and how Submit your AR diagrams and answers to the questions. Part two-What to do: Before starting this part, make sure to complete part one. It will certainly help you to understand and solve this many times the destructor of the class DynString is called? part of the exercise The definitions of the append member tunctions is missing from the file Dynstring.cpp. This function is supposed to change the length of the string. so the function requires the following approach: Allocate a new array of the right length Copy whatever characters need to be copied into the new array Deallocate the old array .Adjust the value of the lengthM variable. Your task is to write the function's implementation. To check that it works download part2.cpp, change the ti f 0 to # if 1 in this file, compile and run your program, and make sure the program output is as it is expected. Exercise C: The DynString class This is an in-lab exercise Part one What to do: Download the files DynString.cpp, DynString.h, partl.cpp from D2L Read the file partl.cpp. Try to visualize what the program will do, including calls to constructors and the destructor. Build an executable using part1.epp and DynString. cpp and run it to see what it does. Make a memory diagram for points-one, labeled in the function truncate. Also answer the following questions At point two in the main function, how many times the constructor and how many times the destructor of the class DynString is called? . . At the end of the main (just before main function terminates), how many times the constructor and how Submit your AR diagrams and answers to the questions. Part two-What to do: Before starting this part, make sure to complete part one. It will certainly help you to understand and solve this many times the destructor of the class DynString is called? part of the exercise The definitions of the append member tunctions is missing from the file Dynstring.cpp. This function is supposed to change the length of the string. so the function requires the following approach: Allocate a new array of the right length Copy whatever characters need to be copied into the new array Deallocate the old array .Adjust the value of the lengthM variable. Your task is to write the function's implementation. To check that it works download part2.cpp, change the ti f 0 to # if 1 in this file, compile and run your program, and make sure the program output is as it is expected
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started