I just wanna check if the user input is float or not, if the user input a string then i want them to do certain action, it can be done with integer, but when i change it into float. it will give a message.
error: invalid operands of types 'bool' and 'float' to binary 'operator>>'|
so this is my code down below.
#include <iostream>
int main()
{
float num;
std::cout << "Input number:";
std::cin >> num;
if (!std::cin >> num){
std::cout << "It is not float.";
}
}