How to get a float number when the variable type is integer?
Hello, I'm just a beginner to C++, so I'm already sorry if my question is boring or stupid. I have this program: https://code.sololearn.com/cZCHbfcOK8eN/?ref=app It gets the four values a, b, c, x and returns the y while y = axÂČ + bx + c. When I enter a float number as the given value to a/b/c/x the program terminates and the wanted operation would not be done, my question is what should I do, that if the user gives a float number, instead of terminating the whole operation, an alert pops up that "Please enter an integer number" and it again asks for a value. My efforts : I thought I may want to use an "If" that checks the variable type of (for example) a, but I have encountered two problems, 1. By using : #include <typeinfo> Int a; Typied(a).name() C++ returns i (stands for integer) even if I assign a float number to it. 2. I don't know how to define what I want, I tried If ( Typied(a).name() == i) ; Else cout << "enter an integer value"; Which obviously doesn't work.