如何判断一段程序是由C编译程序仍是由C++编译程序编译的

 

这个是要由宏定义来判断的ios

若包含的头文件是strio.h,则用c++

#ifdef __cplusplusspa

    printf("C++%c");io

#elsestream

    printf("c%c");di

#endif文件

 

若包含是头文件是iostream.h,则用co

#ifdef __cplusplusprintf

    cout<<"c++";

#else

    cout<<"c";   

#endif

相关文章
相关标签/搜索