how to check datatype of a variable in c++

C++
#include <typeinfo>
...
cout << typeid(variable).name() << endl;
Source

Also in C++: