I just created my first C program!!

I'm very excited. I followed a tutorial here:

and coded a cute little calculator app you can run in the terminal (under any linux box, but if you have windows you'll need to have a C compiler and you'll need to compile it)

Here's the compiled version

To run, open a terminal and drag the file into it and then press enter. The program should start. I'm not sure, however, because I have an AMD64 processor, so it might not work with 32-bit. If that's the case, follow directions below.

And the original code to compile yourself/edit/look at

To compile under linux (works without any problems under ubuntu default):

Open up a terminal and type in:
cd /home/your_username/Desktop/ (or wherever else you downloaded the file)

Then type in:

g++ calc.c -o calc

(you'll get this error: calc.c:52:157: warning: trigraph ??! ignored, use -trigraphs to enable, but that's normal)

Then type into the terminal:


to run the program.

EDIT: I changed the program around a bit so that it now looks better and quizzes you! Get the code/compiled here:


to compile do the same as above, except the command should be
g++ calcquiz.c -o calcquiz

Compiled (on AMD64):

No comments: