-1

please make this code work for many inputs not just two inputs then it terminates

#include <iostream> // requires for keyboard and screen I/O
#include <conio.h>  // for getch

using namespace std;

void main ()

{
	// local values
int frontPad;
int rearPad;
int door;
// output to screen
cout << "Welcome" << endl;
cout << "Enter either 0 or 1 for state of the\nFront Pad,\nRear Pad,\nand the Door" << endl;
cout << "separated by a blank" << endl;
// input 
cin >> frontPad >> rearPad >> door;

// if loop
if ((frontPad==1 && rearPad==1 && door==0) || (frontPad==0 && rearPad==0 && door==0) || (frontPad==0 && rearPad==1 && door==0) || (frontPad==0 && rearPad==0 && door==1))
{
		// output to screen
		cout << "Do not ativate the door\n" << endl;
		cout << "Enter 0 or 1 for the three sensors" << endl;
		// input
		cin >> frontPad >> rearPad >> door;

}	

else if ((frontPad==0 && rearPad==1 && door==1) || (frontPad==1 && rearPad==0 && door==0) || (frontPad==1 && rearPad==0 && door==1) || (frontPad==1 && rearPad==1 && door==1));
{
		cout << "Activate the door\n" << endl;
		cout << "Enter 0 or 1 for the three sensors" << endl;
		cin >> frontPad >> rearPad >> door;



}
	
	getch(); // holding the screen

} // end main
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by WaltP
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.