Due Date: Lecture 8: Monday, March 17
Lecture 14: Tuesday, March 18 Program 0 is designed to give you practice editing, compiling, and executing a program.
If you need help using MS Windows, you may want to read our Introduction to Microsoft Windows. For help with Borland C++, check out our Introduction to Borland C++.
Between the rows of asterisks below is a program. You are to enter this program into the Borland C++ compiler and get it to run (see the tips below). Don't include the asterisks! The program will run as written so you don't need to modify it. We will probably discuss this program (or one like it) during the first week of class.
Please remember to put your login name (not your password!) and your real name in the places indicated in the program. Erase the words ``[your login name here]'' and replace them with your actual login name, and so on. There's no need to leave the [ ]'s in! (Your login name is what you use to get access to the computers; my login name is rmanning, for example.)
*******************************************************************************
//CS110, Program 0
//Section 8 (or Section 14)
// [your login name here...]
// [your real name here...]
#include <iostream.h>
void main()
{
int age, tiger_years;
cout << "Please enter your age in years... ";
cin >> age;
tiger_years = age * 5;
cout << "That makes you " << tiger_years << " in tiger years!";
}
*******************************************************************************
Once you have the program typed into the file window, and you have saved the program in case something bad happens, you just need to press the little lightning bolt button near the top of the screen. Your program will be compiled, linked, and executed. If you miss-typed something, chances are you will get a syntax error. Go back to the program, check your typing, and when the mistake is found, change it and run the program again.
When the program runs, it will create a window and prompt you to enter your age (don't worry, no one's checking!). It will then print your corresponding age in tiger years. You'll know the program is done when the word INACTIVE appears at the top of the window.
One way to turn in your program is to use File Manager in the Main group. From within File Manager, locate the correct hand-in directory by first going to the r: drive and opening the handin folder (to open a folder, double-click on it--a little graphic image of an open folder will appear next to the folder name). Find the folder marked rmanning and open that. Inside you should see two folders: one labelled with your login name and the other labelled "examples". If you don't see both of these, talk to me. The "examples" folder will hold some sample programs and other files used throughout the course.
Open the folder labelled with your login name (your folder!). There's nothing in it now, but as the semester goes by you will keep adding programs to this folder. If you're ever wondering whether I've received an assignment, keep in mind that I see exactly what you see in your folder (so if you see your assignment there, so will I).
Now drop program0.cpp into your hand-in folder. One way to do this is: (1) make sure your personal folder is open, (2) switch to drive u:, (3) find your program0.cpp on drive u:, (4) grab program0.cpp with the mouse, drag it up to the drive r: symbol, and drop it there. Go back to drive r: and check that the program is in your hand-in folder.
Another way to turn in the assignment is by opening a second window in FileManager (use "New Window" under the Window menu). Have one window show drive u:, the other show drive r:. Grab program0.cpp in the drive u: window and drag it over to your folder in the drive r: window.
Another way to turn in the assignment is by using "Save As..." under the File menu in the Borland compiler.
It is important that you are able to finish all parts of this assignment. All the remaining assignments involve the same steps, only in the future you will write your own programs. Be sure to see me if there's something you aren't able to do.