Week 3 - Library Functions and Chars
Learning Objectives
Upon finishing this learning module, you should be able to:
- Use standard library functions to do math and work with characters
- Generate pseudorandom numbers for a desired range
- Use the char data type and understand how it relates to int
- Navigate directories and compile files from the command line
Recommended Schedule
Day 1
- Random numbers and math functions
- Read Ch 3.9, 3.12, 4.1-4.2
- CPPLab Math Functions
Day 2
- Chars
- Read Ch 4.3-4.7
- CPPLab Characters
Day 3
- Command Prompt Work
Day 4
- Review & Take Quiz
Using Functions
Read Ch 4.1 and 4.2. These videos explain some of the basics:
Do Numeric Functions CPPLab.
Random Numbers
Read 3.9 on random numbers. This video explains some of the basics:
Chars
Read Ch 4.3-4.7. This video explains a bit about chars
Do Characters CPPLab.
Working on the Command Line
In parallel with the assignment, do the following activities to start getting familiar with the command line. Before there were windows and mice, the way we interacted with computers was all based on text input into consoles (like the programs we are currently writing). Many tools programmers use work on the command line (behind the scenes, QtCreator is using text based commands to call the compiler) - learning to use the command line is essential.
This video demonstrates the basics:
This Command Line Guide provides detailed instructions for how to open a command prompt, set up the path, navigate, and use g++. Using a QtCreator project, try building and running the code from the command prompt as shown in the video.
For a more detailed treatment read either this Windows command line guide (up to 2.6). or this Mac/Linux command line guide (up to 3.5).
Quiz
The quiz will be open Thursday–Saturday in Elearn, time limited (60 minutes), and not collaborative. It covers weeks 1 & 2. Make sure you block out an hour of uninterrupted time before you start the quiz — you can not pause the timer once you start.
To practice, go to the Resource Links and look for "Book author's website". On the author's website, look for the Quiz tab:
The practice questions are based on the third edition of the book, so later chapters may be numbered slightly differently, but the questions are still great practice.
For quiz 1, focus on Ch1, 2, and 3 (especially 2 and 3) to get ready for the quiz. The quiz will be some multiple choice, some short answer, and some writing code. Make sure to read the directions carefully before beginning.