Description
Course: CSE 165
All the exercises below are selected from the textbook: Thinking in C++ (volume 1).
1. [Exercise-18 on Page 274] Write a function that takes a char* argument. Using new, dynamically allocate an array of char that is the size of the char array that’s passed to the function. Using array indexing, copy the characters from the argument to the dynamically allocated array (don’t forget the null terminator) and return the pointer to the copy. In your main( ), test the function by passing a static quoted character array, then take the result of that and pass it back into the function. Print both strings and both pointers so you can see they are different storage. Using delete, clean up all the dynamic storage. [60 points]
2. [Exercise-4 on Page 299] Write two classes, each of which has a member function that takes a pointer to an object of the other class. Create instances of both objects in main() and call the aforementioned member function in each class. [40 points]
Requirements:
* Usage of spaces, blank lines, indention, and comments for readability
* Descriptive names of variables, functions, structs, classes, and objects (if any)
* Appropriate usage of structs, classes, and objects (if any)
Penalties:
* Zero if you have possession of a copy of online solutions or work done by someone else.
* 5-point deduction per day late
Reviews
There are no reviews yet.