Monday's Session
Thanks for everyone who showed up. If you have any more questions about the mock midterm feel free to ask during today's session (I'd prefer if you came to the classroom session but I can answer questions during lab as well).Brief
The goal for this session is to get everyone all set for the homework this weekend and to get everyone intimately familiar with the concept of control flow.Outline
- [0-10 min] Q & A on anything that's been covered
- [5-15 min] Scoping Review
- Blocks of Code
- [10-20 min] Creating Functions
- Syntax
- Return Values
- Modularity (How and when to use functions, and when not to use them)
- [10-20 min] Loops
- For and While Loop
- Trivia:
- When should you use a for loop and when should you use a while loop?
- What is the scoping for the iterator of a for loop?
- How do you use multiple iterators?
- [10-20 min] Nested Loops
- Iterating through a matrix
- [5 min] Using Rand
- Low + rand() % (Max - Low + 1)
- [5-10 min] Applying Nested Loops in Instinct
- [5-10 min] If statements
Lab Session
I've copied the lab questions below. Hope to see you guys there!Remember: I can't help you with homework! Do the first lab option if your having issues with your homework!Lab Option 1 (designed to help with your homework):
Have the user enter in two numbers, a lower bound and an upper bound. Your program should then output a integer between those two numbers. You must validate the user's input and if the user enters in bad input your program shoudl prompt them to try again. Your main function must not be more than 4 lines of code (including the return statement).
Lab Option 2 (designed to help you with the new material this week and next week's lab):
Create a program which first asks the user for two numbers, an X coordinate and a Y coordinate, each between 0 and 19. It will then print out a 20x20 grid of x-s with the x at the given coordinate (so if the coordinates were 0,0 then the bottom left x) turned into an o. This is a console program, not an instinct program.
Lab Option 3 (designed to challenge those who are finding things easy or want to challenge themselves, for added incentive I'll buy you a danish from bytes if you successfully complete this option):
Create the program above, except prompt the user for a direction after the grid is printed (north, east, south, west), then the o is moved one unit in that direction. If the user attempts to exit the grid, the program should ignore the direction.
No comments:
Post a Comment