Chapter 4: Making Decisions PDF
Document Details
Uploaded by FieryCyan
IIUM
2015
Tony Gaddis
Tags
Summary
This document, part of a programming textbook, introduces relational operators in C++. It explains how to use these operators for comparisons and logical operations in a program. The document uses examples and practical applications to illustrate the concepts.
Full Transcript
Chapter 4: Making Decisions © Pearson Education Limited 2015 Relational Operators ▪ Used to compare numbers and char value and to determine relative order ▪ All relational operators are binary – use 2 operands ▪ Operators: > Greater than...
Chapter 4: Making Decisions © Pearson Education Limited 2015 Relational Operators ▪ Used to compare numbers and char value and to determine relative order ▪ All relational operators are binary – use 2 operands ▪ Operators: > Greater than They have left-to-right < Less than associativity >= Greater than or equal to y == Equal to != Not equal to © Pearson Education Limited 2015 Relational Expressions ▪ Relational expression a.k.a. Boolean expressions –true or false ▪ Examples: 12 > 5 is true Boolean expressions 7 90) { grade = 'A'; cout