any idea how to create a loop if user input wrong characters..?? i tried to do while loop but it never works.. anyone..??
#include <iostream>
using namespace std;
int main () {
double input_x, number;
cout << "Insert value: ";
cin >> input_x;
char choice ;
choice = 'D', 'R', 'd', 'r';
cout << "Insert choice: ";
cin >> choice;
while ( //what suppose i write here?? )
if ( choice == 'D' || choice == 'd' ) {
number = input_x * 3.142 / 180;
}
else if ( choice == 'R' || choice == 'r') {
number = input_x;
}
else {
cout << "Invalid input!" ;
}
}
cout << "The number in radian is: " << number << endl;
}