This assignment introduces the elements of C++ programming. The key challenge here is, "How do software designers write programs for real applications, and how are they translated (compiled) to run on a computer?" The readings and exercises for this assignment are taken from portions of chapter 7 of your text.
Load in turn each of example2.cpp, example3.cpp,example4.cpp and example5.cpp, Compile them and execute them. Look at the code and at the output.
1. Describe briefly in English what each program does.
2. Now open, compile, and run the program "fig25.cpp". Describe briefly in English what this program does.
3. Write a C++ program that computes the sum of two m-digit binary numbers. Assume that m <= 10. The program should ask the user for the value of m and for two m-digit binary numbers and should output the resulting sum. This program should behave just like the pseudocode algorithm that we first saw in Figure 1.2, but now it's been rewritten in C++. Submit your completed program to the csci107 -> Drop Box.
4. Write a C++ program that reads integer values until a 0 value is encountered and then writes out the sum of the positive values read and the sum of the negative values read. Submit your completed program to the csci107 -> Drop Box.
You may do these exercises (except the last one) either by hand or with a word processor (e.g. MS Word). Also, you may choose to do this assignment either by yourself or in a group. However, solutions should be written up individually and handed in on the due date.
To submit a file electronically, you should first rename it so that you are identified as the author (e.g., give it a name like lab-x-ltoma). Then drag the file to the csci107 -> Drop Box folder. Be careful not to drag an entire folder into the Drop Box; only a single file at a time can be submitted.
Once you are finished in the lab, be sure to drag the CS107 icon to the Trash - this step disconnects you from the server and prevents someone else (who may use this iMac later in the day) from accidentally accessing files in your personal folder.