typeid的使用方法
来源:互联网 发布:每天读书 知乎 编辑:程序博客网 时间:2024/05/29 18:01
typeid的使用方法。
这是我写的关于typeid的使用方法的一个总结,为了以后自己能够复习,也供大家参考。
http://blog.sina.com.cn/s/blog_149e9d2ec0102wycr.html
之前在学习中想要知道某个变量的类型时,就感觉好困惑。今天终于找到一个函数可以知道变量是什么类型了。他就是typeid。
首先我们需要知道typeid需要头文件#include; 这个头文件中海油typeof等函数的介绍,
废话不多说,直接上代码:
#include
#include
int main()
{
int i;
floatf;
doubled;
charc;
std::cout<< "i的类型是:" << typeid(i).name() <<std::endl;
std::cout<< "f的类型是:" << typeid(f).name() <<std::endl;
std::cout<< "d的类型是:" << typeid(d).name() <<std::endl;
std::cout<< "c的类型是:" << typeid(c).name() <<std::endl;
return0;
}
程序运行结果如下:
i的类型是:int
f的类型是:float
d的类型是:double
c的类型是:char
请按任意键继续. . .
阅读全文
0 0
- typeid的使用方法
- typeid的用法
- typeid的用法
- typeid的用法-例子
- typeid的作用
- typeid的作用
- typeid的作用
- typeid的深入学习
- C++的typeid
- typeid 的用法
- typeid()的用法
- c++的typeid
- c++的typeid关键字
- typeid
- typeid
- typeid
- typeid
- typeid
- iOS中如何用纯代码绘制比较复杂图表UI
- java与C/C++的不同之处之一(小发现)
- day05
- IO中读取文件并将数字相加
- socket select
- typeid的使用方法
- VirtualBox 共享文件夹设置 及 开机自动挂载
- jQuery高级事件---模拟操作和命名空间
- CentOS上运行BeyondCompare
- sql逐条更新表数据
- 工具类之LocationUtils(定位工具类)
- eclipse 开发工具下载
- Spring+quartz实现定时任务实例
- springboot + birt Design Engine API,Report Engine API