关键词搜索

源码搜索 ×
×

C/C++中#符号的使用

发布2014-11-02浏览7414次

详情内容

  1. #include <iostream>
  2. using namespace std;
  3. #define PR(x) cout << #x << " ---> " << x << endl;
  4. int main()
  5. {
  6. int i = 10;
  7. PR(i);
  8. float f = 10.3f;
  9. PR(f);
  10. return 0;
  11. }

      结果为:

i ---> 10
f ---> 10.3


       但是, 下面程序是有错误的:

  1. #include <iostream>
  2. using namespace std;
  3. #define PR(x) cout << #x << " ---> " << x << endl;
  4. int main()
  5. {
  6. int i = 10;
  7. cout << #i << " ---> " << i << endl;
  8. return 0;
  9. }


相关技术文章

最新源码

下载排行榜

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载