You are on page 1of 4

ASSIGNMENT # 2

Name:
Danish Ali Sheroz

Reg No:
FA22-BSE-008

Submitted To:
Dr Misbah

Subject:
Discrete Structure
CUI
(Sahiwal Campus)
USE OF GATES IN HARDWARE:
A component needed to build digital circuitry is a logic
gate. For digital circuits, they perform fundamentally
crucial logical operations. Most of the technological
devices we use today use logic gates.
Uses in Software:

AND gates are used in software programming and


method creation.

Control Flow:
In computer programming, AND gates are used to control
how operations are carried out.

Boolean Logic:
AND gates are used in software to accomplish Boolean
logic operations like AND, NAND, and XOR. These
procedures are commonly applied in the development of
algorithms.

Bit manipulation:
In software, AND gates are used to carry out bit-wise
operations. These procedures are often used in both
system programming and low-level programming.

Summary:
In addition to being utilised in software for control flow,
Boolean logic, bit manipulation, and system
programming, logic gates are employed to build digital
circuits.

THE FOLLOWING IS THE EXAMPLE OF THE CODE IN


C++ USING THE LOGICAL OPERATORS

Code:

#include <iostream>

using namespace std;

int main() {

int age = 20;

bool is_student = true;

if (age >= 18 && is_student) {

cout << "You are eligible for a student discount." <<


endl;

} else {

cout << "You are not eligible for a student discount."


<< endl;

}
}

OUTPUT:

You are eligible for a student discount

You might also like