1 Content


1.1 Review

Make sure you actually know everything outlined here,
including Bash, VMs, Containers, Git, Standard Input/Output (I/O), etc.:
../../ClassGeneral.html

1.2 Schedule and due dates

The schedule and due dates will be updated as we progress through the semester (on Canvas).
Please check back regularly for changes.

1.3 Topic outline

  1. Introduction and syllabus
  2. Computing, Compilers, Algorthms
  3. Algorithms, pseudo-code, C++ basics
  4. Variables and numeric types
  5. Non-numeric types, arithmetic operators
  6. Operators, integer division, modular arithmetic, casting
  7. Conditional execution (decision branching)
  8. Loops
    1. while loop
    2. do while loop (and some debugging)
    3. for loop
  9. Switch case
  10. Conditional operator, escape characters
  11. Random number generation
  12. Functions
    1. Basics
    2. Pass by reference or value, const
    3. Commenting functions
    4. Function oveloading, static variables
    5. Templating functions
  13. Multiple files
  14. Structs
  15. Arrays
  16. Character arrays and strings
    1. Basics
    2. Functions
    3. Character manipulation, strings
  17. File IO
  18. Object oriented programming
    1. Basics
    2. Set, Get, Const, and friend functions
    3. Constructors
  19. Operator overloading
  20. Class templates
  21. Static members and namespaces
  22. Output formatting and enums
  23. Pointers
  24. Version control
  25. Mystery topic

1.4 Linux bash tutorial

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

1.5 Execution of C++ code

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

1.6 C++ resources

Most importantly, the full resources from a previous year’s course are here:
http://classes.mst.edu/compsci1570/

1.6.1 Tutorials

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/

1.6.2 C++ textbooks

For a more extended discussion of many of these topics, textbooks can be helpful.

1.6.2.1 Free

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

1.6.2.2 Not free

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