Upload
mark
View
217
Download
0
Embed Size (px)
Citation preview
7/24/2019 Pl Report
1/12
Statements
Presented by:
Mark Kevin Camero
7/24/2019 Pl Report
2/12
Statements
Statements fall into three general types:
AssignmentInput / OutputControl
7/24/2019 Pl Report
3/12
oControl Statements
ontrol and modify the flo! of program e"eution#
I$
S%OP
&O%Os
7/24/2019 Pl Report
4/12
Compound statement
group of statements treated as one#
Seletion Statements
provides the means of hoosing bet!een t!o or
more e"eution paths in a program#
7/24/2019 Pl Report
5/12
%!o'(ay Seletors
If )e"pression* statement
+lse statement
single'!ay seletors
$O,%,A- I$
A.&O.0 I$'%1+-'+.S+
7/24/2019 Pl Report
6/12
Multiple Seletion Construts
Selet one of any number of statements orstatement of groups#
7/24/2019 Pl Report
7/12
Iterative Statements
It is defined to be a onstrut that inludes an iterativestatement and a olletion of statements !hosee"eution is ontrolled solely by the iterativestatement#
bodypretest
posttest
Iteration onstrut$ormed if the iteration statement and the assoiated loop body
are in syn#
7/24/2019 Pl Report
8/12
Counter'Controlled .oop ,epeating a set of program statements for a finite
number of times are sometimes alled ounting loop#.ogially'Controlled .oops
these types of loops are based on e"pression ore"pressions evaluated to be either true or false or simply a2oolean e"pression#
pretest loops!hile )e"pression*Statement
posttest loopsdo
Statement
!hile )e"pression*
7/24/2019 Pl Report
9/12
!hile ) 3 40* 5 6 47
or
!hile ) 3 40* 8
5 6 47
97
!hile )4* printf),unning;n
7/24/2019 Pl Report
10/12
=nonditional 2ranhing also alled a >ump or a start? transfers
e"eution ontrol to a speified plae in theprogram#
.abel $orms are formed or are !ritten atually ontributesto the readability of several programminglanguages#
Sope of .abels is the same as that of the variables that aredelared !here the label are delared#
7/24/2019 Pl Report
11/12
+"eption handling is the speial proessing that may be re@uired!hen an e"eption is deteted and done by aode unit # ounter'overflo! or underflo!
invalid memory referenes
unkno!n instrutions
+"eption handling an be done into severalgeneral tehni@ues:
,eturn of status values.abel parameter passing
Separate independent subprogram
7/24/2019 Pl Report
12/12
Standard funtions that return error value:
read returns the number of values read
or '4fopen returns a valid file handle or -=..#