Programming Techniques Lecture 4: Selection PDF
Document Details
Uploaded by BestKnownHeather
Dr Zahriah Othman
Tags
Summary
This document provides lecture notes on selection in programming techniques, specifically covering topics like relational operators, if statements, if-else statements, conditional operators and their usage in C++. The content is structured as a presentation/lecture notes, emphasizing practical implementation and examples of coding logic.
Full Transcript
lecture 4: selection BITP1113: Programming Technique Dr Zahriah Othman Topics: Relational Operators Nested if Statement Logical Operators if…else if…else Statement if Statement switch Sta...
lecture 4: selection BITP1113: Programming Technique Dr Zahriah Othman Topics: Relational Operators Nested if Statement Logical Operators if…else if…else Statement if Statement switch Statement if…else Statement How to Apply Selection Conditional Operator 2 Selection (Part 1) Relational Operators Logical Operators if statement 3 1. Relational operators o Used to compare numbers to determine relative order o Operators: > Greater than < Less than >= Greater than or equal to 5 is true 7 z) T && T true (x > y) && (z > y) T && F false (x 90) grade = 'A'; Place statement; on a separate line after (expression), indented Expanding the if statement o To execute more than one statement as part of an if statement, enclose them in { }: if (score > 90) { grade = 'A'; cout 0) cout