I am fairly inexperienced in C++ and I am designing a program that requires integers, but the values that need to become integers can also be floats, it depends on the user's choice. I have not found anything on how to do these functions. Basically my code looks like this:
float a;
cin >> a;
switch (a) {
case 1:
break;
case 2:
break;
default:
break;
}
And I need to check if it is an integer before the switch statement. Please help.