CS 225 Compiler Trial
CS 225 Fall 1999 Assignment 1 Due Date: September 21, 1999
Introduction
Read the first two chapters of the textbook, This will cover the topics
of the first lecture or two. Since programming is not only required but
essential to understanding the concepts in the class, you need to get familiar
with the tools you will use all term. If you don't have a C++ compiler,
get one. The Free Software Foundations g++ will work fine. If you want
to ask about any commercial compilers before getting one, feel free to
contact me. To encourage this familiarity, here is a small program to start
with.
You should change the code so that it prints your name in addition to the
"something broke" error message.
You should hand in your source listing and example runs. The purpose of
this exercise is to be sure that you have a compiler you can use before
we start the real work. If you have questions, just ask.
// compiler trial code
#include <stdio.h>
#include <stream.h>
class hello {
public:
hello(void) { cout << "Hello, world!" << endl;};
again(void) { cout << "Hello, world again!" << endl;};
boom(void) { cout << "You should see an error" << endl; throw "error";};
}; // hello
int
main()
{
hello h;
try {
h.again();
h.boom();
}
catch ( char * c) {
cout << "something broke" << endl;
} // catch all
}