Lab 1           


The purpose of this lab is to accustom you to the process of running a C++ program.


        Take any one of the complete programs you have seen so far (from the handout, from what I have put on the board, or from the text).  Using one of the editor/compiler programs discussed below, type in the program. Make sure that your name and the date are typed in the comment of the program.


       When you are typing in the assignment, make sure that you are following the indentation pattern shown in class and in the book. Indent the body of the program (the part between the curly braces) 5 spaces. Skip a line after the declaration of the variables.


Next, save the program (call it p0.cpp or assn0.cpp), compile it, and run it.


Copy the output to a file, using instructions below. Save the program and the output on your flash drive.


Saving Output to a File


To save your output, place the cursor in the bar at the top of the output window and right-click. From the menu that pops up, place the cursor over Edit, and another menu will appear to the right. Move the cursor to the new menu, and click on Select All. The window contents will change color. Again place the cursor in the bar at the top of the output window and right-click. From the menu that pops up, select Edit and then Copy. Then go back to the editing environment.


Open a new editor window by selecting File | New | Empty file (in CodeBlocks) or  File | New | Source file (in Dev-C++). Place the cursor in the new window that opens, select Edit | Paste, and the output will be copied into the new window. Save the file using a name like prog1.txt. To do this, select File | Save; then click on the drop down arrow in the "Files of type" box to change the entry  from "C++ source files" or "C/C++ files" to "All files". Then save the file with the extension .txt. After saving the file, you can print it or attach it to an email.


Compiler Instructions


There are two compilers available on the lab computers, Dev‑C++ and CodeBlocks. You should use the same one that you plan to use on your home computer. If your home computer is an Apple iMac, you should use CodeBlocks; if you are running other versions of Windows, you can use either one.‑instructions.pdf