Back Button
Back to Chapter
C++ Introduction
No items found.
C++ Basics
No items found.
C++ Control Statements
No items found.
C++ Logical Operators
No items found.
C++ Procedural Programming
No items found.
C++ Structural Programming
No items found.
C++ Implementation of OOPS
No items found.
C++ Arrays and Vectors
No items found.
C++ Error Handling
No items found.
C++ File Handling
No items found.
Collapse_Icon
Table of Contents

Suppose you want to make a login page and provide multiple options for the user to log in like thumbprint, password, and pin. If any 1 these are correct you grant access.

OR allows us to perform this without having to use multiple if else statements.

From the table it is evident that the truth value of OR is 0 only when Both X and Y are zero.

Let us try to implement a simple log in page using OR to allow access through any one of the options 1. password OR 2.pincode.

#include using namespace std; main() { bool isPassword=false; bool isCode=true; if(isPassword==true)||(isCode==true) { cout<<"access granted\n"; } else cout<<"access denied"; }
Output: access granted