This is just a simple menu and I have no clue why it doesn't work.
using namespace std;
#include <iostream>
#include <iomanip>
#include <fstream>
// ------ Prototypes ---------------------------------------------
void mainMenu();
void newEntry();
void display();
void exit();
// ****** MAIN ***************************************************
int main()
{
mainMenu();
return 0;
}
/* ------ MAIN MENU ----------------------------------------------
1. Save a new password
2. Display all passwords
3. Exit
----------------------------------------------------------------*/
void mainMenu()
{
int choice;
do
{
cout << "** Invalid Entry **\n";
cout << "Please choose 1, 2, or 3.\n";
cout << "1. Save a new password\n";
cout << "2. Display all passwords\n";
cout << "3. Exit\n\n";
cout << "Choose 1, 2, or 3: ";
cin >> choice;
}while(choice != 1 || choice != 2 || choice != 3);
switch(choice)
{
case 1: newEntry();
break;
case 2: display();
break;
case 3: exit();
break;
}
}
void newEntry()
{
cout << "New Entry";
}
void display()
{
cout << "Display";
}
void exit()
{
cout << "Exit";
}
Any integer including the valid 1,2,3 send error, and any non int sends it to infinite loop. This is absolutely basic and I'm beginning to wonder if I may have had a recent head injury because I can't for the life of me track down this MFing problem.