// onlyme.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include<stdlib.h>
using namespace std;
int inputa;
int inputb;
int Andgate(void);
int orgate(void);
int notgate(void);
int andgate(void)
{
cout<<"input Gate A, enter 1 or 0, enter 2 to end program ";
cin>>inputa;
cout<<"input Gate B, enter 1 or 0, enter 2 to end program ";
cin>>inputb;
if (inputa == 2 || inputb == 2)
{
return 0;
}
if (inputa== 1 && inputb == 1)
{
cout<<"Output is logic one \n";
}
else
{
cout<<"Output is logic zerro \n";
}
andgate();
}
int orgate()
{
cout << "input Gate A, enter 1 or 0, enter 2 to end program";
cin >> inputa;
cout << "input Gate B, enter 1 or 0, enter 2 to end program ";
cin >> inputb;
if (inputa == 2 || inputb == 2)
{
return 0;
}
if (inputa == 0 || inputb == 1||inputa==1||inputb==0)
{
cout << "Output is logic one \n";
}
else
{
cout << "Output is logic zerro \n";
}
}
int notgate()
{
cout << "input Gate A, enter 1 or 0, enter 2 to end program";
cin >> inputa;
cout << "input Gate B, enter 1 or 0, enter 2 to end program ";
cin >> inputb;
if (inputa == 2 || inputb == 2)
{
return 0;
}
if (inputa ==!0||inputb==!1 )
{
cout << "output is ligic one\n";
}
else
{
cout << "output is logic zero\n";
}
int _tmain(int argc, _TCHAR* argv[])
{
int choice;
while (1)
{
cout << " enter 1 to and gate\n enter 2 to or gate\n enter 3 to notgate ";
cin >> choice;
switch (choice)
{
case 1:
Andgate();
break;
case 2:
orgate();
break;
case 3:
notgate();
break;
case 4:
exit(0);
}
}
system("pause");
return 0;
}
please correct my errors