Control Structures CPS120: Introduction to Computer Science Lecture 5 What Can a Program Do? A program can only instruct a computer to:
Read Input Sequence Calculate Store data Compare and branch Iterate or Loop Write Output Fundamental Programming Concepts Assignment of values to a variable
Iteration (Looping) Over a set of set of statements With respect to a logical expressions (conditions) Delegation of sub-tasks to functions / procedures The Structure Theorem
The Structure Theorem states that any algorithm can be built from three basic control structures. One-after-another (Sequence) Decision-making (Selection) Making choices between 2 or more alternatives Repetition (Iteration)
Concerned with repetitive tasks (and the termination conditions of loops) C++ Control Structures 1. "Sequence statements" are imperatives 2. "Selection" is the "if then else" statement AND, OR, NOT and parentheses ( ) can be used for compound conditions 3. "Iteration" is satisfied by a number of statements
"while" " do " "for" 4. The case-type statement is satisfied by the "switch" statement. CASE statements are used for most non-trivial selection decisions
Sequence Control Structures Sequence control structures direct the order of program instructions. The fact that one instruction follows another in sequenceestablishes the control and order of operations. Calculate A program can instruct a computer to perform mathematical
operations. Add 1 to Counter Store A program will often instruct a computer to store intermediate results. Place 1
in Counter Compare and Branch A program can instruct a computer to compare two items and do something based on a match or mismatch which, in turn, redirect the sequence of programming instructions. There are two forms: IF-THEN IF-THEN-ELSE IF-THEN
Entry Test condition p Exit false true True statement a
IF-THEN-ELSE Entry Test condition p false false statement a true Exit
true statement a Iterate A program loop is a form of iteration. A computer can be instructed to repeat instructions under certain conditions. No
Iteration Control Structures Iteration control structures are looping mechanisms. Loops repeat an activity until stopped. The location of the stopping mechanism determines how the loop will work: Leading decisions Trailing decisions Leading Decisions If the stop is at the beginning of the iteration, then the control is called a leading
decision. The command DO WHILE performs the iteration and places the stop at the beginning. DO WHILE Loop Entry Exit No Test condition p Yes
Loop statement a Trailing Decisions If the stop is at the end of the iteration, the control mechanism is called a trailing decision. The command DO UNTIL performs the iteration and puts the stop at the end of the loop. DO UNTIL Loop
Entry Loop statement a Test condition p Exit No Yes
1997 Caldicott Report. The Caldicott Guardian. Follow the Caldicott Principles to ensure Patient/Client Confidentiality. Justify the purpose of disclosing confidential information. Only disclose it when absolutely necessary. Use the minimum info required.
ESD damage cannot be seen by the naked eye. Only very sophisticated high magnification photography with the aid of a scanning electron microscope, can show the damage. * Per ESD Handbook TR20.20 section 126.96.36.199.2 ESD Effects "In the electronics industry,...
Findings/Approach Established statistics of natural images relevant for contour grouping [Geisler, Perry, Super & Gallogly, 2001] Space Variant Imaging Research Centers/Labs CPS Space Variant Imaging Laboratory for image and video engineering (LIVE) Laboratory for Artificial Neural Systems Focus ...
The Implications of Differential Trends in Mortality for Social Security Policy. John Bound, ArlineGeronimus, Javier Rodriguez, University of Michigan. ... 28% of death certificate reports do not match earlier CPS self-reports in linked data.
Clients with a healthy or ill retrovirus positive cat may be frightened by the initial diagnosis. It is important to alleviate these fears when appropriate and offer encouraging advice on the proper care and management of the cat. ... Feline...
Uncertainty How "certain" of the data are we? How much "error" does it contain? Also known as: Quality Assurance / Quality Control QAQC Definitions Rigor Manage uncertainty from collection to publication and dissemination Due diligence Document the uncertainties as best...
- where a hormone stimulates the gland to release its hormone. tropic. hormone - a hormone that stimulates a gland to release another hormone-tropin. a suffix often used on tropic hormones. 2. Humoral - where the gland monitors the conditions...
they would sell their possessions and goods and distribute the proceeds to all, as any had need. Day by day, as they spent much time together in the temple, they broke bread at home and ate their food with glad...
Ready to download the document? Go ahead and hit continue!