我正在使用 Visual Studio C++。我希望能够在 double 和 long long 之间切换。如何在以下程序中使用#ifdef?我想使用更简单的解决方案来处理多个 printf 的情况。
//#define TYPE_SWITCH
#ifdef TYPE_SWITCH
typedef double myType;
#else
typedef long long myType;
#end
.
.
.
int main()
{
myType a;
#ifdef TYPE_SWITCH
printf ("my value is %lf",a); // I have many printf or scanf and I want to use a simple macro here
#else
printf ("your value is %l",a/10); // I have many printf or scanf and I want to use a simple macro here
#endif
}