Previous Lecture | lect02 Before Slides | lect02 Annotated Slides | Next Lecture |
Code from lecture
https://github.com/ucsb-cs16-s18-mirza/cs16-s18-lectures/tree/master/lec-02
Topics
Learn multiple important topics using a game of fizzbuzz
- Simple input/output with cin, cout
- Just fizz (using cin to get input, C++ variables)
- The full game (nested and multiway if-else, boolean expressions)
- Create the usage: ./fizzbuzz
(passing command line arguments) - Fizzbuzz in a loop (for loops), get loop limit from command line
Simple flow control structures- For and while loops
- If else statements are DIFFERENT in C++ than in Python. We’ll discuss.
- Nested and multi-way if-else
C++ variables and datatypes (contd)
- Scope and lifetime of variables
- Uninitialized variables in C++
- We will look at three specific datatypes: char, int and string
- Evaluating C++ expressions
- lvalue and rvalue
- Boolean expressions