Programming Languages: Input and Output --> Compound Statements - PowerPoint PPT Presentation

About This Presentation
Title:

Programming Languages: Input and Output --> Compound Statements

Description:

a language with limited words and limited rules designed to solve ... in arithmetic example, operands of multiplication are the multiplier and the multiplicand. ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 21
Provided by: lisa277
Learn more at: http://www.cs.loyola.edu
Category:

less

Transcript and Presenter's Notes

Title: Programming Languages: Input and Output --> Compound Statements


1
Programming Languages Input and Output --gt
Compound Statements
Carey Beth Robillard
2
Programming Language
  • a language with limited words and limited rules
    designed to solve problems on a computer
  • most common languages is the C language,
    developed by Dennis Ritchie.

3
More to come...
  • Input and Output
  • Expressions
  • Operator and Operand
  • Statements

4
Input
  • Data are input by either
  • a statement
  • predefined function.

5
Input Continued
  • example scanf function reads data from the
    keyboard and stores it in a variable
  • scanf (d, num)
  • d prepares the program for an integer
  • Value is stored in the variable num

6
Output
  • Data are output by either
  • a statement
  • predefined function

7
Output Continued.
  • In C language, the printf function displays a
    string on the monitor
  • Printf (The value of the number is d , num )

8
Expressions
  • a sequence of operands and operators that reduces
    to a single value
  • example expression for 10 2 5

9
Operator
  • a language specific token that requires an action
    to be taken.
  • most familiar are drawn from mathematics.
  • example asterisk () means multiplication.

10
Arithmetic Operators
11
Arithmetic Operators Continued
12
Other Operators
  • Relational operators compare data to see if a
    value is greater than, less than, or equal to
    another value.
  • Logical Operators combine logical values (true or
    false) to get a new value.
  • Assignment operators store values in a variable.

13
Some Relational Operators
14
Logical Operators
15
Some Assignment Operators
16
Operands
  • receives an operators action
  • for any given operator, there may be multiple
    operands
  • in arithmetic example, operands of multiplication
    are the multiplier and the multiplicand.

17
Statements
  • causes an action to be performed by a program
  • translates into executable computer language.
  • C language has 6 types of statements expression,
    compound, labeled, selection, iterative, and jump.

18
Statements Continued
  • Expression is turned into a statement by placing
    a semicolon after it. When C sees the semicolon,
    it performs the evaluation on the expression.
  • Examples a b 4 and c b c 4

19
Compound Statement
  • A compound statement is a unit of code consisting
    of zero or more statements. It is also known as a
    block.
  • The compound statement allows a group of
    statements to become one single entity.

20
The End
Write a Comment
User Comments (0)
About PowerShow.com