Week 1 - Introduction to C++ Programming
Learning Objectives
Upon finishing this learning module, you should be able to:
- Describe how a C++ program goes from source code to working program
- Identify the functions of basic components of a C++ program
- Do basic console input/output
- Use assignment and the basic math operators
Schedule Checklist
You have a lot of freedom to choose when you get the work done each week. But trying to do all of your learning in one monster day of studying tends to be much less effective than breaking up your practice. The schedule below
There are often mid-week deadlines (check Canvas for deadlines), so you can't wait until the weekend to get everything done. If your schedule requires you to do most of your work for this class on the weekend, you should try to work ahead on the next week each weekend rather than playing catchup from the previous week. That way you have plenty of time to ask questions and get any needed help before your assignments are due.
Day 1
- Review Syllabus and Class Policies. Take class policies quiz & background survey
- Read Ch 1.1-1.6
- Install QtCreator at home
Day 2
- Start C++ & Development Basics
- Finish Ch1, Ch 2.4-2.6
- Do MentalCodeDebugging WS (in Files area of eLearn)
Day 3
- Continue C++ & Development Basics
- Ch 2.1-2.3 and 2.8-2.10
- Check out the assignment - make sure you understand the problems
Day 4
- Finish C++ & Development Basics
- Read Ch 2.14-15
Course Intro
Review the Syllabus (in eLearn) Background survey and Class Policies quiz in eLearn. The Class Policies quiz can be taken as many times as you like before the deadline. Make sure to get 100%!
CS Background
Ch 1.1-1.6 will be mostly review if you took CS160. If not, don't panic about memorizing every detail. Just skim for an overview of how software and computers work.
Getting Started With QT Creator
Start by installing and setting up Qt Creator. The video below demonstrates the last part of the installation - placing the QtProject folder in the correct location as well as how to use QTCRreator to make a build a project:
If you get stuck installing QTCreator, the repl.it website can be used as a short term alternative for writing and running code. Use it while you work on getting QT up and running. It is NOT a long-term solution.
This video explains how to make use of course code samples:
The videos here may show versions of the website or QTCreator that don't exactly match the current versions. If you can't find something, or anything doesn't work as the video says it does and you can't easily see how to fix it, please raise the issue in the discussion forum.
For any video, you can click in the lower right corner to watch on YouTube. You can then use the settings icon there (Gear symbol at bottom of video) to watch at higher quality. Doing so can make a big difference when trying to read code examples.
All code you submit must build using standard C++. Using QTCreator will help make sure you write code that will be acceptable. It will also make it easier to test out my code samples.
If you try to use another tool for programming (XCode on Mac, Visual Studio on Windows) and don't know what you are doing, you are going to have a harder time and be more likely to turn in code that does not work correctly. Start out with QTCreator and experiment with other tools as you get more experience.
C++ & Development Basics
Work your way through the rest of Ch 1. This video has a quick recap to what the parts of a
very basic program do:
Read 2.4-2.6 and watch this video:
The debugger is a CRITICAL tool for learning programming. It is what lets you look at what your code is doing step by step. This video introduces it:
Do the MentalCode worksheet to practice using the debugger and test your understanding of how math works in C++ (See the Files link in Elearn/Canvas to access this and future worksheets). There is a key you can use to check your work on the front of the sheet. The back you should be checking with the debugger!
Once you are done with it, watch this video about some of weird answers:
Now you should loop back and read 2.1-2.3 if you haven't. This video reviews key bits about getting input:
Start the assignment as you finish 2.8-2.10 and 2.14 and 15. This video talks through building the time program from 2.10 to show how you should approach building programs... one step at a time:
Extra Info
Learncpp.com
The Learn C++ online tutorial covers some of the same ground as the Liang readings. Use it as a supplement or second opinion if you ever need one on a topic. This week overlaps somewhat with their chapters 0, 1.1–1.3, 2.1–2.5, and 3.1–3.2.
Compiling details
Looking for more information on what exactly happens when code is compiled? Read this compiling and linking tutorial.