设为首页 加入收藏

TOP

c/c++宏定义,#,## 代码实例
2018-06-09 10:07:44 】 浏览:181
Tags:c/c 定义 代码 实例

# —— 字符串

##——连接两个参数

#include <iostream>
using namespace std;

#define TEST(pid) (cout<<para##pid<<endl);
#define TEST2(p) (cout<<#p<<endl);
int main()
{
    int para3 = 3;
    int para2 = 2;
    TEST(2);    //<==>cout<<para2<<endl;
    TEST(3);    //<==>cout<<para3<<endl;

    TEST2(test)        //<==>cout<<"test"<<endl;
    TEST2("test2");    //<==>cout<<""test2""<<endl;
    system("pause");
    return 0;
}
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C++继承的基础知识讲解 下一篇C++模板学习之泛型编程简介

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目