Class Notes (807,356)
Canada (492,721)
Computing (443)
CISC 110 (4)
Lecture 4

CISC 110 Lecture 4: CISC110 Week 2, Class 3 Notes

3 Pages
Unlock Document

Queen's University
CISC 110
Wendy L Powley

COM SCI 110, Week 2, Friday Class 09/23/2016 Variables o Syntax The set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language o Comments Allow people to read your code, understand your code, and maintain and change your code. Makes it easier to read. Not every line needs commenting – but sections do! At the top of your program you should have a header: “” This program draws a picture of a …[ cat and it is a really ugly cat but it is the best that I can do.] Written by: Mack Horton Student Number: 10105658 Date: Sept 20, 2016 Date Modified: XYZ “” o Open source Allows other parties to access and modify the code. What is the difference between a syntax error and a logic error? o Syntax errors Show I have screwed up in my syntax, I haven’t formatted my program correctly o Logic error I did not do what I expected to do. I.e., I wanted to draw a line from 0, 0 to 100, 100, but instead I got confused and drew a line from 0, 0 to 10, 100. Variables Just as in algebra, a value can be assigned to a variable such as “x”. When variables x appears inside and expression, it evaluates to its assigned value. Hard coding – all shapes, parameters, were vertices, lengths, that were all numbers. House starts at 100, 100. Vertex is here, and this vertex is here. Normal coding – is with pictures, by relative distances and things. If I were to draw a cat with 200 pixels, and drawing area 500 x 500. COM SCI 110, Week 2, Friday Class 09/23/2016 What if? Did not want a drawing error of 500 x 500 but rather, 200 x 200 or 250 x 250. The cat would be drawn perhaps outside of the drawing area. What if! It did not matter the size of your drawing area. So that the cat can fit within the drawing area regardless of the drawing area size. This is based on a ratio / value / variable. Use print function to print the value of your variables. In processing the print function is used by programmers only. Used to evaluate the variables you assign while the program runs. Variable Expression Size (500, 500) X = 3 X=3 Print (x) Print (x) 3 Print (4*3) 12
More Less

Related notes for CISC 110

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.