Implementation of Logical Gates in C++ Programming Language Using Functions


Implementation of Logical Gates in C++ Programming Language:

The output of logical gates AND, OR and NOT using Functions are become easy with the help of the C++ program execution.

Code of Logical Gates Implementation:

 #include<iostream>
using namespace std;
int and(int x,int y);
int or(int x,int y);
int not(int x);
void main()
{
int x,y;
cout<<"Enter 1st Number"<<endl;
cin>>x;
cout<<"Enter 2nd Number"<<endl;
cin>>y;
cout<<"AND logical gate execution"<<endl;
cout<<and(x,y)<<endl;
cout<<"OR logical execution:  "<<endl;
cout<<or(x,y)<<endl;
cout<<"Not Logical execution:  "<<endl;
cout<<not(x)<<endl;
}
int and(int x,int y)
{
if(x==1 && y==1)
return 1;
else
return 0;
}
int or(int x,int y)
{
if(x==0 && y==0)
return 0;
else
return 1;
}
int not(int x)
{
if(x==1)
return 0;
else
return 1;
}

Bookmark this website for more new c++ programs codes and presentations.Thanks for visiting this blog.Download this code from below:




Comments

Popular posts from this blog

How to Run Assembly Language Programming Code In Visual Studio 2019

Boss Home Appliances

How to Display Table of any Number in Assembly Language