You are calling the macro like this : getName(num), so it can not possibly display mynum. I had a similar problem and I did something like this :
#define printValue( val ) print( val, # val )
int print( int num, const char * name )
{
std::cout << name << ": {" << num << "}" << std::endl;
}
int main()
{
int mynum;
std::cout << "enter number->" << std::endl;
std::cin >> mynum;
printValue( mynum );
}