First book read.
This is a good primer into programming and I read it in this light, rather than as a guide to finding a career in programming. I concentrated on the C++ areas.
Some code differed in the book to what my compiler required. Eg, std:: was needed before text inputs and outputs. I later discovered I could add a reference at the start of my code to remove the need for typing std:: all the time.
Plugin? references before the int main also did not need the .h at the end.
Compiling is platform specific. i.e. I could use the built in C++ Ubuntu compile to run on Ubuntu, but for windows, I needed to install another module. My first compiling attempts for Windows were failures. Various dll’s were reported as missing. This required me to add in additional commands when sending my code into the compiler. I created a readme for myself regarding coding and compiling. An early iteration follows:
To complie C++ programs the options depend on where the program is to be run:
Comments in C++ are marked by //
Run On Linux:
g++ <source filename> -o <output filename>
To run compiled programs from Bash:
Run on Windows (x64):
/usr/bin/x86_64-w64-mingw32-g++-win32 -static-libgcc -static-libstdc++ /<path>/<filename>.cc
/usr/bin/x86_64-w64-mingw32-g++-win32 -static-libgcc -static-libstdc++ -o /<path>/<output name>_w64.exe /<path>/<input name>.cc
Adding the libgcc and libstdc++ fixes up 2x missing dll errors that are thrown when not used.
Need -o to output. Output comes before input (nah, that does not matter).
Loads more options in /usr/bin/ depending on what system the program needs to be compiled for.
Naming convention (mine)
Raw code: <filename>.cc
Compiled Linux program: <filename>.cc.exe
Compiled Windows program: <filename>.exe
While modifying program to spit out kph rather than area, it would always understate the kph. I found out that using int was no good. Ints hold whole numbers. Trying add the % of the calculation would not work either as though that produced the remainder, the remainder now appeared as a whole number. What met my needs here was float. Float let me produce values with decimal places.