CS31-1

CS31-1 - CS 31: Introduction To CS I Topic 1: Introduction...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-1 CS 31 : Introduction to Computer Science I Topic 1 Introduction to Programming CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-2 Introduction to Programming PROGRAMMING PROCESS EXAMPLE Driving a Car CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-3 Introduction to Programming Programming Process Example Types of Contol Sequential: Step-by-step Selection: One of choices Repetition: Repeated step CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-4 Program Control Flow Sequential One Step at a Time Begin End Compute Compute Compute Compute CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-5 Program Control Flow Selection One of Choices Compute Compute Condition Begin End CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-6 Program Control Flow Repetition Repeated Step Begin End Condition Initialize Compute Update CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-7 Program Control Flow Composition Replace any Sequential Step with a Selection or a Repetition CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-8 Program Control Flow Composition Example Guess a Number Between 0 and 100 CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-9 Program Control Flow Example Guess a Number Between 0 and 100 Set G to 50 G = N? N Y Done: G is N G < N? N Y Add C to G Set C to 25 Subtract C from G Divide C by 2 Start G is the current guess C is the current change N is the chosen number CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-10 Introduction to Programming Programming Steps 1. Specification: Description of the Task 2. Analysis: Understanding the Task 3. Test Data: Complete Set of Tests 4. Design: Data and Algorithms 5. Implement: Write the Program 6. Test and Debug: Make It Work CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-11 Algorithm Design Tools Flow Charts Pseudocode CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-12 Algorithm Design Flow Charts Graphical Symbols Easy to Visualize Flow Difficult to Draw in Comments Examples: Flow of Control Diagrams CS 31: Introduction To CS I Topic 1: Introduction to 1/2009 John A. Rohr All Rights Reserved JAR 1-13 Algorithm Design Flow Chart Example Guess a Number Between 0 and 100 Set G to 50 G = N?...
View Full Document

This note was uploaded on 04/12/2009 for the course CS 31 taught by Professor Melkanoff during the Winter '00 term at UCLA.

Page1 / 81

CS31-1 - CS 31: Introduction To CS I Topic 1: Introduction...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online