Today - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Today

Description:

In between grades: if you skip homework or mess up on exams. General outline of the grade ... Each one is like a spreadsheet cell, only dumber. March 2005. 17 ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 23
Provided by: ricks6
Category:
Tags: run | today | up

less

Transcript and Presenter's Notes

Title: Today


1
Todays Class
  • Introductions
  • About the Course
  • Fundamentals
  • Computer
  • Program - Sequence
  • Parts of a computer
  • Parts of a CPU
  • Writing a really short program
  • Homework

2
I love programming
  • 20 year career, then went into something else
  • My dad HATED programming
  • My own kids never really tried it
  • Some people will find they love it
  • Some will hate it, and some are in the middle
  • The GOAL to be capable at programming

3
Class Survey
  • Who is sitting next to you?
  • Their name? Major?
  • Why are they taking the course?
  • What computer skills do they bring to this class?

4
Class Schedule
  • Ill arrive about 5 minutes early or so every day
  • Lectures start at 955 AM, Tue/Thu
  • Ends at 1135
  • Lab starts at 1055 AM M-W-F
  • Ends at Noon
  • Both Lecture and Lab will usually start with a
    new technique

5
Syllabus
  • Real syllabus tomorrow
  • Learning C programming
  • The basic mechanics
  • Assignments and variables
  • Conditionals
  • Loops
  • Input/Output
  • Structure with multiple procedures
  • Arrays
  • Learning Matlab
  • Many of the same concepts
  • Built in features for mathematical problem
    solving
  • Lots and lots of programming

6
Grading
  • I do it by the numbers
  • Its easy to earn an A-like grade do the work
  • Its easy to flunk dont do the work
  • In between grades if you skip homework or mess
    up on exams
  • General outline of the grade
  • Part goes to homework
  • Part goes to exam (a similar weight)
  • Part goes to final project
  • Ill hand out grade sheets with your grade
  • NO LATE WORK as a rule
  • Need bona fide reason for late work

7
How the class works
  • Memorization and programming
  • This is lots and lots of detail work
  • You work fast if you work from memory
  • Practice and remember patterns that work
  • Do the Reading!
  • It gives you another source for programming
    details
  • A different way of describing the same stuff
  • A place to go to answer questions
  • Some problem sets based on the reading
  • Labs programming tasks to do
  • Try to finish DURING lab
  • If you dont, then you have extra homework

8
Fundamentals
  • Computer
  • Program - Sequence
  • Parts of a computer
  • Note they are built hierarchically
  • Parts of a CPU

9
C Program
  • Always in a file
  • Always defines a function to perform
  • Usually the function is named main
  • We compile it to make it work

10
Sample C Program
  • include ltstdio.hgt
  • int main (void)
  • printf("Hello, world\n")
  • return 0

11
Observations
  • Case sensitive match cases exactly
  • Program is worked in order from start to end
  • Sequences are fundamental to computing
  • Curly braces mark nested components
  • Hierarchies are fundamental to computing
  • Learn the patterns of typical programming tasks
  • Setting up the program
  • Doing output

12
Compiling - the mechanics
  • Command Line compiling
  • Should work the same on PCs and Macs
  • You have to compile programs to run them
  • gcc hello.c
  • You simply command the computer to run the
    program
  • hello
  • Hello, world!

13
Homework
  • Read Chapters 1 through 3
  • Find a C compiler on a computer you can use
  • Already installed on 4th floor OSS
  • May be installed on other campus computers
  • You can download it and install it at home
  • For PC use MinGW, thats whats installed here
  • Write a program that prints your name
  • Ideally, use your U drive or a USB drive
  • Run it and see the result
  • Print the C file. Include an explanation of
    where you compiled and ran it, and note any
    problems you had.

14
Whats happening next?
  • A history of C
  • Overview of Statements and Variables
  • Simple types
  • Printing out text
  • The nuts and bolts of compiling programs

15
History of C
  • Interpreting expressions (1940s)
  • Sort/Merge Generator
  • A2 Compiler
  • Fortran
  • Algol
  • C

16
Statements and Variables
  • Statements well use
  • Function declarations like main
  • Always followed by a pair of parentheses,
  • and then curly braces
  • Other statements are followed by a
  • Variable declarations
  • Assignment statements
  • Variables
  • Storage cells in your program
  • Each one is like a spreadsheet cell,
  • only dumber

17
Variable Naming
  • Naming Structure
  • First character A-Z, a-z, _ or
  • Remaining same plus digits
  • Style rules
  • Descriptive names
  • Usually start with lowercase letter
  • Camelback use capitals to mark words
  • itemsOrdered, totalPayment
  • DO NOT USE to start a name

18
Types of variables
  • First use you say the type
  • int integer
  • signed, no decimal part, less than 2G
  • Examples
  • int sampleInt 12
  • sampleInt 25

19
Printing
  • The printf() function
  • Syntax of functions
  • Takes 1 or more arguments or parameters
  • First argument format string
  • A string of characters to print
  • Embedded signals to say what else to print (
    character)
  • Each signal corresponds to a subsequent
    parameter
  • Extra parameters
  • One per format signal

20
Blanks, newlines, tabs
  • Hello There
  • Hello There
  • \n, \t

21
Compiling and Running
  • What is really happening?
  • How a program executes
  • Computer Languages
  • Interpeting
  • Compiling
  • Running real instructions
  • What it looks like in RAM

22
Creative Commons License
  • This work is licensed under the Creative Commons
    Attribution-Share Alike 3.0 United States
    License. To view a copy of this license, visit
    http//creativecommons.org/licenses/by-sa/3.0/us/
    or send a letter to Creative Commons, 171 Second
    Street, Suite 300, San Francisco, California,
    94105, USA.
Write a Comment
User Comments (0)
About PowerShow.com