Wednesday's Session
Thank you everyone who showed up last Wednesday. Hopefully you guys were able to absorb the material as this weeks assignment will be very close to what was covered. I think I'm going to try and persuade you guys a bit more to go to both the lab and classroom sessions rather than just one because I ended up re-covering a lot of material in the lab that I went over in class, and the people who came from the class didn't quite absorb everything. If you came last week, I really urge you come to today's session (Monday) as I'm going to be reinforcing the concepts I covered last week along with giving an introduction to what we'll be covering on Wednesday.Brief
The goal for this session is to concrete the concepts we went over last week into everyone's minds. We went over a lot last week and it seems apparent that a lot of people are struggling a lot with things. I also want to go over coding style and best practices. I'm also going to introduce what we'll be doing this week, namely taking in input from the user. I really encourage you to come, as I assure you that you've forgotten what we covered Wednesday (if you were there, if you weren't, definitely come).Key Terms
These are the key terms everyone should be familiar with at this point. You should also look at the key terms listed in previous sessions as you should of course know those as well.Declaration Statement - The statement which declares a variable. Follows the syntax [data type] [variable name];.
Initialization Statement - A shortcut/blending of the Declaration Statement. Follows the syntax [data type] [variable name] = [initial value];.
Assignment Statement - A statement which sets the value of a variable. Follows the syntax [variable name] = [value];. Notice that the variable is always on the left and the value is on the right. It does not work the other way around.
Data Type - The type of a piece of data (variable, return value of a function, etc.). The data types you should know about are int, float, double, string, and bool.
Stream Insertion Operator (<<) - Inserts some data into a stream. You should know its strange placement in the order of operations. You should also know why you can chain them together (ex: cout << "a" << "b";).
Assignment Operator (=) - See Assignment Statement above.
Variable - A variable holds a piece of data. Its like a placeholder. It can be loosely related to a variable in math.
Stream - A stream is an object which takes in lots of different kinds of data and does something magical with it. It is not actually a part of C++ but rather is a part of the Standard Library.
Standard Library - The standard library is a large collection of libraries which holds lots of incredibly useful tools and is available on virtually every platform that C++ supports.
Reserved Word - A reserved word is a word that is part of the C++ language. If you use an IDE like CodeBlocks, reserved words are typically bolded and made a different color. int is a reserved word, string is not since its not actually a part of C++ (its a data type defined by the Standard Library)
Outline
- [0-10 min] Q & A on anything that's been covered
- [5 min] Written partner quiz. Will be turned in. Will not count of any kind of credit.
- [10-30 min] Review of last week
- Quickly revisit quiz from last week
- Variables
- "A named location in memory."
- Data Types: int, float, double, string, bool, signed int, unsigned int, long, signed long, unsigned long.
- Non-initialized Variables (int i; cout << i;)
- Naming
- All lowercase letters
- Seperate words by an underscore
- Use meaningful variable names
- Functions
- Significance of main function
- Case-sensitivity
- Difference between int and double
- [15-25 min] Coding practices exercise from last Wednesday
- [5 min] More on functions
- You may do anything in functions that you can do within main (especially since main is just a function anyways)
- [10-20 min] Taking input from the user
- Input Stream cin
- Stream Extraction Operator (>>)
- Bad input, fail states
- [3 min] Review of quiz
No comments:
Post a Comment