How can I compile/run C or C++ in Unix console or a Mac terminal?
(I know it, forget it, and relearn it again. Time to write it down.)
This is the command that works on all Unix machines... I use it on Linux/Ubuntu, but it works in OS X as well. Type the following command in Terminal.app.
$ g++ -o lab21 iterative.cpp
-o
is the letter O not zero
lab21
will be your executable file
iterative.cpp
is your c++ file
After you run that command type the following in terminal to run your program:
$ ./lab21