i really need help my assigment is due tomorrow morning and iam stuck on this.
When i select gate number 2 its OR from logic gates i input 0 ,1 i should get a 1 for a logic gate. and iam getting a 0. can someone please help me
Code:
#include <iostream>
inline int OR(int x, int y)
{ if(x==0||y==0)
{
return (0);
}
else
return(1);
}
using namespace std;
int main()
{
int i, choice,gate1,gate2,x;
cout<<"Types of gates available"<<endl;
cout<<"1. AND"<<endl;
cout<<"2. OR"<<endl;
cout<<"select gate # (1 to 5) =>";
cin>>choice;
if(choice==2)
{
cout<<"Enter two inputs for gate #"<<1<<endl;
cin>>gate1>>gate2;
x = OR(gate1,gate2);
cout<<x;
}
cin.sync();
cin.get();
return 0;
}