Make sure you actually know everything outlined here,
including Bash, VMs, Containers, Git, Standard Input/Output (I/O),
etc.:
../../ClassGeneral.html
The schedule and due dates will be updated as we progress through the
semester (on Canvas).
Please check back regularly for changes.
You will be working with the Linux computers in the lab, and need to
be comfortable with the command line. I highly suggest completing this
tutorial:
../CompSciTools/Content/LinuxBash.html
We use C++ 11 and 14+ features.
If you are using an old computer (campus machines),
then you may need to specify a higher version: -std=c++14
or -std=c++11
If you are using the class VM or container, then you do not need to
include version options at compile time.
All code for my classes must be auto-formatted by clang-format using the
following arguments.
Pre-check with:
$ cppcheck yourcode.cpp
or more specifically:
$ cppcheck --enable=all --language=c++ ./*.cpp ./*.h ./*.hpp
Pre-format with:
$ clang-format.py -i --style=Microsoft ./*.cpp ./*.h ./*.hpp
Compile with debug flags:
$ g++ -g file1.cpp fileN.cpp -std=c++14
Compile with extra nagging (a good thing):
g++ -g -Wall -Wextra -Wpedantic -pedantic-errors *.cpp -o yourbinexe
To run:
./a.out
For example, run with:
$ ./a.out
or
$ ./a.out <"sample_input.txt"
or
$ ./a.out <"sample_input.txt" >"your_output.txt"
Check for memory leaks with:
$ valgrind ./a.out <"sample_input_if_exists.txt"
or, for example:
$ valgrind --leak-check=full ./a.out <"sample_input_if_exists.txt"
Debug your code:
using cgdb
$ cgdb ./a.out
(gdb) start
or
(gdb) start <stdinfile >stdoutfile
(gdb) start arg1 arg2 argn <stdinfile >stdoutfile
or use gdb
$ gdb ./a.out
(gdb) layout next to show code
(gdb) start
or
(gdb) start arg1 arg2 argn <stdinfile >stdoutfile
Most importantly, the full resources from a previous year’s course
are here:
http://classes.mst.edu/compsci1570/
https://learnxinyminutes.com/docs/c++/
http://www.cplusplus.com/doc/tutorial
https://www.tutorialspoint.com/cplusplus
http://www.studytonight.com/cpp
http://www.learncpp.com/
http://www.cppforschool.com/
For a more extended discussion of many of these topics, textbooks can be helpful.
These books are listed in order of quality:
http://python.cs.southern.edu/cppbook/progcpp.pdf
http://www.greenteapress.com/thinkcpp/thinkCScpp.pdf
https://rooksguide.files.wordpress.com/2013/12/rooks-guide-isbn-version.pdf
https://en.wikibooks.org/wiki/C++_Programming
These two are quite good, and either is recommended, but not
required:
Absolute C++, Savitch, 4th or later edition
https://www.pearson.com/us/higher-education/program/Savitch-Absolute-C-plus-My-Programming-Lab-with-Pearson-e-Text-Access-Card-Package-6th-Edition/PGM199128.html
Problem solving with C++, Savitch
https://www.pearson.com/us/higher-education/program/Savitch-Problem-Solving-with-C-Plus-My-Programming-Lab-with-Pearson-e-Text-Access-Card-Package-10th-Edition/PGM1743309.html