{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

208 Day 05 Selection

208 Day 05 Selection - 4002-208Intro to Prog[in C]Day...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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: 4002-208Intro. to Prog. [in C++]Day 05SelectionObjectives•Basic if statement•Relational conditions•Nested if statements•Logical conditions24002-208Uses of if Statement•Algorithm–Used in algorithm to compute correct values.•Data validation–test input values to ensure the value satisfies prescribed conditions. –Invalid data can cause a program to “crash” or produce incorrect results. 34002-208ExampleEnglishIf the sun is shining, we will go to the beach;otherwise we will go to the bowling alley.Pseudo-Englishif (sun is shining)go to beachelsego to bowling alley44002-208Relational Operators•A condition must be written so that it can be evaluated as true or false.•Logical operators: <less than<=less than or equal to>greater than>= greater than or equal to==equal to!=not equal to54002-208if/else Statementif (condition){block of code to be executed if condition is true}else{block of code to be executed if condition is false}//continue execution here64002-208Exampleif ( age >= 21 )...
View Full Document

  • Spring '09
  • Niemi
  • Equals sign, relational operator, data validation, Relational conditions Nested, statements Logical conditions

{[ snackBarMessage ]}

Page1 / 17

208 Day 05 Selection - 4002-208Intro to Prog[in C]Day...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online