Date: Mon, 11 Nov 1996 21:42:14 GMT Server: NCSA/1.5 Content-type: text/html Last-modified: Tue, 29 Oct 1996 14:24:33 GMT Content-length: 4037
CS110 Section 8
TA: Michael Birk
Assigned: Tue 9/29/96
Due: Tue 10/5/96
Program 0 is designed to provide experience with the lab machines, the software we will be using, and the handin process. You are not expected to write any C++ code on your own or understand the given code in any way.
This assignment does require, however, minimal working knowledge of Microsoft Windows. If you are unfamiliar with Windows and don't want to "jump right in," then check out the Introduction to Microsoft Windows.
Note: If you have difficulty at any point during this assignment, do not hesitate to ask the on-duty lab consultants for assistance. That's what they're there for, and they need something to keep them busy during this first week. :-)
First, you must go to the lab in 1350 Comp Sci & St and log in. Of course, since you're reading this now, you've probably gotten that far already! After logging in, run Borland C++ by double-clicking on its icon. Since you will be starting a new program, choose "File" and then "New" from the menu. This will bring up a blank editing window for you to enter your program.
Now you are ready to type in the source code for Program 0. The source code is found on page 21 of the Savitch text book. (In case you didn't bring your book, click here to see the source code.) Type this program in exactly as it is written. Now, so that you know which program is yours when you print it out, add a comment (a line beginning with two slashes) at the top of your program with your name and other information. For instance, the top few lines of your program might look something like this:
// John Q. Doe CS110 Section 7 // Program 0: Sample C++ Program
After you have entered the source code, give you program a name by choosing "File" and then "Save as" from the menu. (Initially your program will have the rather mundane title of "noname00.cpp".) In the window that pops up, type prog0. This will save your source code in a file named "prog0.cpp" (Borland C++ automatically adds the ".cpp" suffix, which stands for "C-plus-plus.")
Now, compile and run the program by clicking on the small "lightning bolt" icon (or choose "Debug" and then "Run" from the menu). This will bring up yet another window, which asks you to enter the number of "pods" and "peas in a pod," then calculates and prints the number of "peas in all." Afther this, the window becomes "inactive," meaning the program has finished and you should close the window by double-clicking on the box in the upper-left corner.
If, when trying to run your program, you get "errors" instead of a blank window, this means that you made a typo when entering the source code. Find the typo and fix it, and then try running the program again. The line number of the error message may give an indication of where the typo is.
Try running the program a few times, entering different numbers. After you've tested the program and are certain it is working, print a hard copy by selecting "File" and then "Print" from the menu. Click "OK" on the window which pops up. This printout will show up on one of the laser printers in room 1359. (Unfortunately, there is no simple way to know which of the four printers it will be on.)
That's it! Hang on to the printout, and hand it in at the beginning of class on the due date. You can now exit Borland C++ by choosing "File" and then "Exit" from the menu. To log out of the system, choose "File" and then "Exit Windows" from the Program Manager window.