lect04 Selection

lect04 Selection - Announcements Quiz Grades Posted on...

Info iconThis preview shows pages 1–7. 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 DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Announcements Quiz Grades Posted on blackboard Quizzes Handed Back Next Wednesday Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal) : Control of Execution Proceeds One after the Other Selection (if-then-else) : Control Proceeds Dependent on Conditions Iteration (looping) : Control Repeated until Condition Met C++ if Statement Syntax Syntax if ( condition ) statement ; If Condition Is True, Statement Is Executed If Condition Is False, Statement Is Not Executed If Multiple Actions Are Required for Statement, a Compound Statement Must Be Used: if ( condition ) { statement ; statement ; } Conditional Operators Relational Operators : < , > , >= , <= Equality Operators : == , != Selection Examples if (age < 30) cout << You are very very Young << endl; if (grade == A) cout << Congratulations! << endl; if (grade != F) cout << You passed! << endl; else Statement Syntax: if ( condition ) { statement(s) ; //condition true } else { statement(s) ; //condition false } if-else...
View Full Document

This document was uploaded on 03/03/2010.

Page1 / 13

lect04 Selection - Announcements Quiz Grades Posted on...

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

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