xxxxxxxxxx
if (typeid(variable) == typeid(std::string)) {
std::cout << variable << " is a string" << std::endl;
}
else {
std::cout << variable << " is not a string" << std::endl;
}//you can do this for every type
xxxxxxxxxx
#include<iostream>
using namespace std;
main()
{
auto variable = 45;
cout << typeid(variable).name() << endl;
}