I have another question regarding activating of an automatic door:
three sensors front pad, rear pad, and door; they determine weather the door is activated or not.
front pad=0 empty
front pad=1 occupied
rear pad=0 empty
rear pad=1 occupied
door=0 closed
door=1 open
there are situations when the door is activated or not :
front pad rear pad door activation
0 0 0 no
0 0 1 no
0 1 0 no
1 1 0 no
0 1 1 yes
1 0 0 yes
1 0 1 yes
1 1 1 yes
I wrote the code but it is not outputting the result
#include <iostream>// requires for keyboard and screen I/O
#include <conio.h>
using namespace std;
void main ()
{
int frontPad=0;
int rearPad=0;
int door=0;
cout << "Welcome" << endl;
cout << " Enter either 0 or 1 for state of the Front Pad,\n Rear Pad,\n and the Door" << endl;
cout << " separated by a blank" << endl;
cin >> frontPad;
cin >> rearPad;
cin >> door;
if ((frontPad ==0 && rearPad==0 && door==0) || (rearPad ==0 && rearPad ==0 && door==1) || (rearPad ==0 && rearPad ==1 && door==0) || (rearPad ==1 && rearPad ==1 && door==0))
{cout << "close" << endl;
cin >> frontPad;
cin >> rearPad;
cin >> door;
}
else (rearPad ==0 && rearPad ==1 && door==1) || (rearPad ==1 && rearPad ==0 && door==0) || (rearPad ==1 && rearPad ==0 && door==1) || (rearPad ==1 && rearPad ==1 && door==1))
cout << "open" << endl;
cin >> frontPad;
cin >> rearPad;
cin >> door;
getch(); // holding the screen
} // end main