Originally Posted by
StainedBlue
Don't i feel silly.
1) use a char for "switchn"
2) look at specifically:
should be:
You're logical condition is actually correct.
No, changing the datatype is masking the real issue here.
Code:
#include <iostream>
#include <limits>
using namespace std;
int main()
{
int switchn = 0;
do
{
cout<<"Please choose conversion type"<<endl;
cout<<"1.) Ra to RMS\n";
cout<<"2.) RMS to Ra\n";
cin>>switchn;
system("cls");
//If the read failed.
if(!cin)
{
//Clear the error flags.
cin.clear();
}
//Remove the erroneous input until a new line.
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
while (!(switchn == 1) && !(switchn == 2));//end of do-while
cout << switchn;
system("pause");
}