Not sure why the while loop is not working although I think I specified what input was previously in the code.
#include <iostream>
using namespace std;
int main()
{
do
{
cout<<"1. \tOpen File"<<endl;
cout<<"2. \tClose File"<<endl;
cout<<"3. \tExit"<<endl;
int input;
cin >> input;
cout<<"Select and option: "<<endl;
switch(input)
{
case 1:
cout<<"Opening File"<<endl;
break;
case 2:
cout<<"Closing File"<<endl;
break;
case 3:
cout<<"Exiting..."<<endl;
break;
default:
cout<<"Invalid Entry"<<endl;
}
}
while (input < 1 || input > 3);
return 0;
}
I expect the program to ask for my input and if a type a wrong input the program would repeat