Point value: 10
Date due: send email (using
mail utility) to your lab instructor by 11:59pm Fri, Sep 15
This exercise is designed to introduce you to
Reading and correcting compiler
- reading and correcting compiler
- C++ output statements
- Login to your cs account (Linux).
- Open a new terminal window and use the following command to copy the
file exercise04.cpp into your account:
- Compile your
program. There will be several compiler errors.
Here is a sample error message:
exercise04.cpp:4:1: error: expected �;� before �int�
This message indicates that at or before line 4
the compiler thinks that a semicolon (;) is missing.
- Open another terminal window.
Start emacs by typing the command: emacs
yourfilename.cpp (press Enter)
- Move the cursor to line 4 (the
display at the bottom of the screen will show you which line
the cursor is on). Look closely at line 4 and what comes
before it to locate the error. Add the needed semicolon.
- Save the change (ctrl-x ctrl-s).
Go back to the other terminal window and try to compile. You
should see that you have reduced the number of error messages.
- Repeat the process of reading
messages, correcting the errors, and recompiling until the
program compiles correctly. NOTE: If you are having problems
identifying errors, take a close look at your exercise #1
- Once you have the program
compiling and running,
- Add a comment before the first
line of the program file with your name, lecture and lab
section #s, and exercise #.
- Insert a print (cout) statement
into the program that displays your name, lecture and lab
section #s, and exercise #. This output should be displayed
BEFORE the original output (This is
- Use the mail utility to email your
program file (with the comment and new print statement) to
your lab instructor. Make sure that the subject line of your
message includes your name, lab and lecture section #s, and
exercise #. Remember to send from bobby.cs.unlv.edu (compile
and run on bobby before sending message.)