True diamonds conditional test two arrows emerge one

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: computer to apply a completely different function 04/29/09 R. Smith - University of St Thomas - Minnesota 9 Flow charting • A graphic way to show control flow – Arrows show the order of execution between steps Input X False • Boxes – One or more statements or function calls or other comptuational actions X < 0? True • Diamonds – Conditional test – Two arrows emerge • One for test = true • One for test = false X = -X Print X 04/29/09 R. Smith - University of St Thomas - Minnesota 10 The ‘if’ statement • Implements conditional flow in C • Syntax: if ( expression ) statement ; • Expression – result interpreted true/false • Statement – any C statement • Multiple statements – Enclose them in curly braces { } – Individual statements must end with semicolons 04/29/09 R. Smith - University of St Thomas - Minnesota 11 Using flow charts • When designing a progra...
View Full Document

Ask a homework question - tutors are online