Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Logical Operators | Introduction to Operators
C++ Introduction

Logical OperatorsLogical Operators

You have to use the logical operators NOT (!), AND (&&), and OR (||) to evaluate multiple conditions concurrently. Let's illustrate using logical operators in real-life scenarios:

  • I will take my wallet for a walk if there is a bank AND a shop on the way;
  • I won't take my wallet for a walk if there is NOT bank on the way;
  • I will take my wallet for a walk if there is a bank OR a shop on the way.
cpp

main.cpp

What will the program output?

Select the correct answer

Everything was clear?

Section 3. Chapter 3
course content

Course Content

C++ Introduction

Logical OperatorsLogical Operators

You have to use the logical operators NOT (!), AND (&&), and OR (||) to evaluate multiple conditions concurrently. Let's illustrate using logical operators in real-life scenarios:

  • I will take my wallet for a walk if there is a bank AND a shop on the way;
  • I won't take my wallet for a walk if there is NOT bank on the way;
  • I will take my wallet for a walk if there is a bank OR a shop on the way.
cpp

main.cpp

What will the program output?

Select the correct answer

Everything was clear?

Section 3. Chapter 3
some-alt