Kate Gregory with material from Deitel and Deitel - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Kate Gregory with material from Deitel and Deitel

Description:

Monday, Jan 6, 2003. Kate Gregory. with material from Deitel and Deitel. CO 204. CO 204 ... Text: Harvey M. Deitel, Paul J. Deitel. C How to Program, 3rd Edition. ... – PowerPoint PPT presentation

Number of Views:131
Avg rating:3.0/5.0
Slides: 20
Provided by: kategr
Category:

less

Transcript and Presenter's Notes

Title: Kate Gregory with material from Deitel and Deitel


1
CO 204
  • Object Oriented Programming
  • 2003
  • Trent University
  • Kate Gregory

2
Agenda
  • About Me
  • Administrivia
  • Overview
  • Intro to C

3
Class Times
  • 300 500 Lecture
  • Usually break around 400 for 10-15 minutes
  • 500 550 Tutorial
  • Less formal, more one-on-one
  • Save non-urgent questions for this hour

4
Web Site
  • www.gregcons.com/204
  • Lecture PowerPoints
  • Usually available before class
  • Companion Word and Excel documents
  • Assignments, handouts
  • Please email me if you need HTML versions of
    these
  • Announcements of test dates and other information
    of interest
  • Reminder of my phone numbers and email

5
Administrivia
  • Text Harvey M. Deitel, Paul J. Deitel. C How
    to Program, 3rd Edition.
  • Office Hours Before and after class and by
    appointment downtown
  • Web Support www.gregcons.com/204
  • kate_at_gregcons.com anytime
  • Grading Scheme 7 Labs 35, Midterm 25,
    Final 40

6
Course Schedule
7
Labs and Assignments
  • 7 Labs, each worth 5
  • Typically each will be drawn from end-of-chapter
    exercises in text
  • One lab may cover several weeks of material
  • Each is due one week after it is handed out
  • Late penalties HURT

8
Marking Labs
  • A working program does not mean a perfect mark
  • Comment your code meaningfully
  • Make sure your code solves the problem you were
    given
  • Hand in whatever extras are requested such as
    problem statement, sample output
  • Some marks are allotted for test techniques

9
Overview Topics Covered
  • Introduction to C
  • Control Structures
  • Functions
  • Arrays
  • Pointers
  • Strings
  • Classes
  • Data Abstraction
  • Operator Overloading
  • Inheritance
  • Virtual Functions
  • Polymorphism
  • Stream IO
  • Templates
  • Exceptions
  • File IO

10
Design vs Coding
  • You will learn how to code a feature, such as
    inheritance
  • You will not learn how to decide whether a system
    should use the feature
  • Design is CO 362
  • Most paid programmers start as coders and are
    allowed to design later
  • You will learn the benefits and advantages of
    these language features.

11
History C
  • Evolved by Ritchie from two previous programming
    languages, BCPL and B
  • Used to develop UNIX
  • Used to write modern operating systems
  • Hardware independent (portable)
  • By late 1970's C had evolved to "Traditional C"
  • Standardization
  • Many slight variations of C existed, and were
    incompatible
  • Committee formed to create a "unambiguous,
    machine-independent" definition
  • Standard created in 1989, updated in 1999

12
History C
  • Superset of C developed by Bjarne Stroustrup at
    Bell Labs
  • "Spruces up" C, and provides object-oriented
    capabilities
  • Object-oriented design very powerful
  • 10 to 100 fold increase in productivity
  • Dominant language in industry and academia

13
Files in C
  • foo.cpp source code
  • foo.h header file
  • Typically .h files are included into source files
  • Source files are each compiled into obj files
  • Several obj files are linked into an exe
  • Sometimes a lib file is linked in also
  • The exe can be executed, or run
  • Extensions and naming conventions may vary

14
Important times
  • Compile Time
  • Link Time
  • Run Time
  • When is something known?
  • When does an error happen?
  • When is a decision made?

15
C Gotchas
  • Case Sensitive if and IF are different
  • You must declare variables
  • You must initialize variables
  • Ignores line breaks you must mark ends of lines
    with
  • Compiler does not read indents
  • Brace brackets are sometimes optional use
    them anyway

16
Strongly Typed
  • All variables in C have a type
  • int,char, float, etc
  • int i 3.4
  • float f Hello
  • The compiler is your friend

17
The main() function
  • This is what the operating system runs
  • // Everybodys first program
  • include ltiostream.hgt
  • int main()
  • cout ltlt "Hello, Trent!"
  • return 0

18
Learning Already
  • Function
  • Indenting styles
  • include
  • cout ltlt
  • return
  • Historical allusions Unix, foo, Hello World

19
For Next class
  • Read Chapters 1, 2, and 3 of text
  • Ensure you know how to use the C compiler in
    the lab or on your own computer (the text comes
    with a copy of Visual C.)
Write a Comment
User Comments (0)
About PowerShow.com