CS304: Lecture 1 - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

CS304: Lecture 1

Description:

Provides capabilities for object-oriented programming. Hybrid ... Standard output stream object. std::cout 'Connected' to screen. Stream insertion operator ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 9
Provided by: matthe49
Category:

less

Transcript and Presenter's Notes

Title: CS304: Lecture 1


1
CS304 Lecture 1
  • Basics of C Programming
  • Deitel, Ch. 1-5
  • http//www.cis.uab.edu/cs304

2
Overview
  • Who am I?
  • Who are you?
  • What is this course?

3
C vs. Java
  • C extension of C
  • Provides capabilities for object-oriented
    programming
  • Hybrid language
  • C-like style
  • Can have global functions or data. Java cant
  • OO style
  • Fast
  • Originally designed for OS development, can be 20
    times faster than Java.
  • Complex
  • Preprocessor Appendix F (pp. 1272)
  • Macro, templates, operator overloading
  • And more
  • Google "Comparing C and Java!

4
Typical C Environment
5
Hello World!
  • include ltiostreamgt // preprocessor directive
  • using stdcout // scope operator
  • int main()
  • cout ltlt "Hello, world!\n" // stream operator
  • return 0

6
Structure of a C Program
  • Comments
  • Single-line comment
  • Begin with //
  • Preprocessor directives
  • Processed by preprocessor before compiling
  • Begin with

7
Structure of a C Program
  • Standard output stream object
  • stdcout
  • Connected to screen
  • ltlt
  • Stream insertion operator
  • Value to right (right operand) inserted into
    output stream
  • Input stream object
  • gtgt (stream extraction operator)
  • Used with stdcin
  • Waits for user to input value, then press Enter
    (Return) key
  • Stores value in variable to right of operator
  • Converts value to variable data type

8
Structure of a C Program
  • Namespace
  • std specifies using name that belongs to
    namespace std
  • std removed through use of using statements
  • using statements
  • Eliminate use of std prefix
  • Write cout instead of stdcout
Write a Comment
User Comments (0)
About PowerShow.com