Get a file
- Mash the link and download a Gzipped NetBeans project.
- Save the project in your home directory.
- If java is installed (unlikely), we’ll try to out.
- Otherwise, use download the
blastoffclass and save it in the desktop.
Java to C tranformation
You’ll have to pay attention.
- Go to the command line and start nano.
- Get rid of the class stuff. Leave only the
mainmethod. - Add an include for stdio.h and stdlib.h .
- Turn the
mainmethodinto amainfunction header. - The assignment to i is OK.
- We will use
atoito convert the argument, even it is doesn’t do any error checking. - Be sure to use
argv[1]! - The
ifneeds no changes. - You can delete the
try-catch. - The
forheader is fine. - Replace
system.out.printfwith a simpleprintf. - Replace
system.out.printlnwithputs. - Be sure to return 0.
Compiling
Follow along for this one.
You really do need a Randy Bryant approved Makefile like this.
CFLAGS = -std=c99 -Wpedantic -Og -g all: blastoff blastoff: blastoff.c clean: rm blastoff *.o *~
Watch out for the tabs!
C++ program
Although every C program can make it through the C++ compiler, C++ has a unique style of I/O.