CSC155 Assignment 1: C++ Drills Assignment Designation: asn1 Due Thursday 2/3/05 1. Read the "Quick and Dirty" Java to C++ tutorial. Read it even if you think you already know C++. 2. Following the last example program in the tutorial, write a program that takes a linked list of arbitrary length and store the elements into an array (i.e., the reverse of the tutorial's program). You need to create a *dynamic* array, the size of which is determined at runtime (depending on the length of the linked list). Don't forget to deallocate the list. Depending on how you decide to write the program, you may wish to modify the cell and list classes in the tutorial. For example, you may want to add a variable "cell* last" to the list class to point to the last cell of the list, so that adding new elements to the end of the list will become more efficient. 3. Consider the following Java program: ///// class bigobject { public int x = 1; } public class bigprogram { public static void f(bigobject A) { A.x += 1; } public static void main(String[] args) { bigobject B = new bigobject(); f(B); System.out.println(B.x); // should print 2 } } ///// (Please note that you don't need to create the "bigprogram" class in C++: the main and f functions should be standalones, which are static by default) If you read the tutorial carefully, you should know that it's possible to write this program in C++ in two distinct ways: with and without using pointers and dynamic allocation. Write BOTH C++ versions. Do they behave differently? Explain why. Draw a diagram for each version that explains what is happening in memory. ///////////// Expected Coding Practices: * Indent and comment meaningfully, as you learned in previous courses. * Do not use goto, break (except in switch) or global variables * Confine IO (cin, cout) to main, or specific IO functions, or for tracing. * Every call to new must be associated with a delete * Put your name and assignment number at the top in comments * Paste the output results and written answers to other questions * to the end of the file in comments.