Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome to Mario Kart!... Er… EECS 183 Discussion!

Similar presentations


Presentation on theme: "Welcome to Mario Kart!... Er… EECS 183 Discussion!"— Presentation transcript:

1 Welcome to Mario Kart!... Er… EECS 183 Discussion!

2 OMG I GET TO TALK ABOUT MYSELF!
My name is Austin Brehob; you can just call me Austin, unless you are feeling especially adventurous My umich is I’m a Junior majoring in CS, looking into Machine Learning and Artificial Intelligence I’m weird as toast-nuggets, so I apologize if my weirdness is too much to handle I love all kinds of games; video games, board games, card games, sports, etc. I sometimes have a hard time hearing, so don’t feel bad if I ask you to repeat what you said (maybe multiple times)

3 Logistics Office hours are 3:00-8:00 M and W-F; 3:00-6:00 Tuesday in 3rd floor Duderstadt (on North Campus) First part of discussion section will be review of tricky concepts from lecture Second part will be you completing a worksheet in pairs/groups Remaining time will be spent discussion common coding/style mistakes and answering questions

4 What Are Your Names?

5 Yay! Meeting people! You will be working with other students a lot in this section, so don’t be shy and meet new people! What is your: Name Year Favorite part about last summer Favorite type of potato (baked, mashed, steak fries, sweet potato fries, etc.)

6 Important Terminology
Algorithm: Set of instructions to solve a problem Pseudocode: An algorithm expressed in your own words Integrated Development Environment (IDE): An application which helps you create/compile code Source Code: An algorithm expressed in a programming language Compiler: Software that turns source code into object code Object Code: (the computer understands how to run this)

7 MOAR Important Terminology
Variable: A piece of code that allows for storage and retrieval of data Reserved words: Words that may not be used as variable names because they have special meanings to the compiler Declaration: int numPotatoes; (sets up space in memory for data) Initialization: numPotatoes = 21763; (sets the variable to a particular value)

8 Questions?

9 Tricky Concepts

10 Size of a Problem One of our goals as programmers is to use efficient algorithms to solve problems. Algorithms that take the same amount of extra time when a new element is added to the input are said to take “n” time Counting people in a room, where it takes 0.5 seconds to count a single person Algorithms that take less and less extra time when a new element is added to the input are said to take “log(n)” time Searching through a dictionary, where it takes 10 seconds to find a page and look at the word

11 Insertion vs. Extraction Operators
Insertion operator: “<<“ Inserts data into an output stream, which displays the information Used with “cout” Extraction operator: “>>” Extracts data from an input stream, which means that it reads data given from user (or a file) Used with “cin”

12 Memory Much of the data stored on your computer is stored in “memory”
The size of data is measured in “bits”, which are just 0’s or 1’s We when talk about memory in lecture/discussion, each spot in memory holds one variable It doesn’t matter what the data type of the variable is! (int, string, bool, etc.) In actuality, different data types take up a different amount of space in memory: Bool: 1 bit Char: 8 bits Int: 32 bits Double: 64 bits String: Depends on how many characters

13 Special Characters Characters can be more than just letters and numbers Does this look familiar?: cout << “Hello World!\n”; The ‘\n’ is a SINGLE CHARACTER, despite looking like two You’ll probably only see ‘\n’ and maybe ‘\t’ Almost everyone uses “endl” instead of ‘\n’ Also, remember that characters are in single quotes and strings are in double quotes!

14

15 Integer Division vs. Double Division
This topic will be covered next lecture, but it was mentioned in a previous lecture, so I will clarify a bit now When you divide two integers, the result will be an integer (rounded down) 5 / 3 = 1 When you divide using one or two doubles, the result will be a double 5.0 / 3.0 = … 5 / 3.0 = … 5.0 / 3 = …

16 The Modulus Operator Using the ‘%’ will give you the REMAINDER from division It only works with integers “10 % 3” is the same as “What is the REMAINDER of 10 / 3?” 10 % 3 = 1 44 % 4 = 0 67 % 128 = 67

17 Questions?

18 Worksheet Time! Please work on the worksheet with 1 or 2 other people
Make sure you communicate about equally; don’t have one person doing all the work We will go over the answers once everyone is finished

19

20 Common Style Errors from Project 1

21 File Headers Headers should follow the format:
/** * File name * * Your name * Your uniqname * Project title * File description * More file description */ Make sure to have a separate description for EACH file!

22 Variables Good coding style is ESSENTIAL so that others who read your code can understand it very easily Variable names MUST use either camelCase or snake_case Let’s say we want a variable for the number of cupcakes we want to bake: “cupcakes” is too short because it doesn’t describe what ABOUT the cupcakes the variable represents “numCupcakes” is sufficient “numCupcakesToBake” is better “numCupcakesWeWantToBakeAndServeToFriends” is bad for obvious reasons (it’s WAY too long) Make sure your variable types make sense “int numCupcakes” makes more sense than “double numCupcakes” because you won’t be serving partial cupcakes

23 Upcoming Deadlines Zyante Chapter 2 Sections 1-15, Chapter 3 Section 1: By lecture on Tuesday Zyante Chapter 3 Sections 2-9: By lecture on Thursday Assignment 1: By 6:00 on Friday

24 Questions?

25


Download ppt "Welcome to Mario Kart!... Er… EECS 183 Discussion!"

Similar presentations


Ads by Google