Monday's Session
Thank you everyone who showed up this afternoon and helped me get everything together. I'm sorry for the chaos and lecture-like structure, first days are always interesting. Hope to see you in this next session; we have lots of interesting material to cover Wednesday.Brief
The goal for this session is to have everyone understand every piece of the classic "Hello World" program and be able to easily finish this week's homework and next week's lab. We will be learning the basics of C++ and we will be turning an algorithm (a set of instructions) into a working program that you can run on your computer. The program that we will make will be very similar to your homework assignment for this week.There is a classroom session and a lab session, I encourage everyone to attend both. The classroom session is probably the most important though.
The lab session will likely not take the full two hours for most people, and people are free to come and go as they please. Feel free to come halfway through if you have class for the first part (please try to be on time for the classroom session however as I have lots of material I would like to touch on). I will be providing one-on-one help to everyone and helping everyone get used to helping eachother in lab.
The session on Monday was very ad-hoc. There wasn't too much material to cover since we'd only been back for a day. This Wednesday session is where we really get to do some interesting things and where I'll be able to really start helping people. I hope to see plenty of people there.
Key Terms You Should Know
Here are some key terms you should familiarize yourself with. If you have trouble with any of them please ask during session.Machine Code - The only language that the CPU understands.
Programming Language - Human-readable languages that programmers like to deal with so they don't have to work with Machine Code.
Source Code - Code or text (written in a programming language) that, when compiled, makes a program.
Program - A block of Machine Code that can be executed by your operating system. A program compiled for one operating system (Windows, Mac, Linux) will almost certainly not work on any other operating system.
Compiler - A translator which takes your Source Code written in a Programming Language and transforms it into Machine Code which your CPU can understand.
Outline
Classroom SessionYou may notice there's lots of material. I don't plan on getting through it all but I wanted to over-prepare just in case.
- (0 to 10 minutes) I'll address any questions about topics covered in lecture.
- (5 minutes) Quiz (not actually counted for any kind of credit) on the "Hello World" program shown in lecture. My attempt to gauge people's understanding of the material in lecture. Will also help prepare you for Dr. Miller's quizzes.
- (5 to 30 minutes) We will share our knowledge and dissect, together, the classic C++ "Hello World" program (shown below) to fix any confusion.
I briefly outline what each line is and the components of each line below. We will go over any details which people are having trouble with. If Dr. Miller isn't able to get to it in lecture Wedesday I'll go over it all so everyone has a chance to gain a solid understanding for next week's lab.
#include <iostream>
using namespace std; int main() { cout << "Hello World!" << endl; return 0; }
- "include" statement
- Header files
- Standard library
- "Declaring things" which you can use
- Mini-Quiz: What does the compiler actually do when you write #include <iostream>
- "using" statement
- Namespaces
- Buckets
- Briefly: the scope resolution operator (::)
- Functions
- Naming (must begin with a letter or underscore, must contain only alphanumeric characters and underscores)
- Return Value (touch briefly on)
- Parameters (which I won't actually address)
- Brackets and blocks of code
- Mini-Quiz: Write a function which returns the product of 3 and 4.
- "cout" - Standard Output Stream
- Streams
- Stream Insertion Operator (<<)
- Strings
- endl
- (10 to 20 minutes) Variables
- How data is stored by the computer (binary)
- How we interpret data stored on the computer (data types such as string, int, etc.)
- Declaring a variable
- Assigning to a variable
- Performing arithmetic and concatenation
- Mini-Exercise: Write a code snippet which evaluates 6!
- (15 to 25 minutes) Coding practices
- Exercise
- Write an algorithm to do something with two objects (juggle two balls, make a knot with two strings, have to people do the tango). You may only refer to the two objects as A and B. Each instruction may only use 1 verb, and cannot be more than 6 words. Example:
- Raise A
- Move A forward
- Lower A
- Raise B
- Move B forward
- Lower B
- Trade algorithms with a partner. Try to determine what eachother's algorithms do without telling eachother.
- Make a note at the top saying what A is and what B is, and put comments next to any instruction that are confusing.
- Trade algorithms again.
- Naming Conventions, Commenting, Tabbing, and how to properly structure code so your TA loves you.
- (5 minutes) Mini-quiz (again, not counted for a grade)
Our lab will be very similar to one of your typical labs for CS 10. You can think of it as a practice run for the real labs, however, it will be most useful as a time to put what you've learned into practice and actually cement it all into your mind before you are quizzed on it.
The focus of our lab will be to create the following program (we will be expanding on this program throughout the quarter until we all have our own facebook clones).
Create a program facebook which will output the main page of a console program Facebook. Your entire program should be contained in the file main.cpp and should contain the following variables in your main function: username, friendCount, hometown, description.
The output of the program will be similar to the following:
+--facebook--------------------+
Name: [username] ([friendCount])
[description]
[username] comes from [hometown].
+------------------------------+
No comments:
Post a Comment