C++点滴
来源:互联网 发布:婚庆网站源码下载 编辑:程序博客网 时间:2024/06/16 18:52
(×)程序运行时间统计代码
http://stackoverflow.com/questions/876901/calculating-execution-time-in-c
http://stackoverflow.com/questions/2808398/easily-measure-elapsed-time
( × ) 变量类型范围和数的二进制表示
int var_int_min = 0xFFFFFFFF;int var_int_max = 0x7FFFFFFF;cout << "var_int_min: " << var_int_min << endl; //输出-1,why?cout << "var_int_max: " << var_int_max << endl;//cout << "the size of is: " << sizeof() << endl;cout << "the size of bool is: " << sizeof(bool) << endl;cout << "the size of char is: " << sizeof(char) << endl;cout << "the size of wchar_t is: " << sizeof(wchar_t) << endl;cout << "the size of char16_t is: " << sizeof(char16_t) << endl;cout << "the size of char32_t is: " << sizeof(char32_t) << endl;cout << "the size of short is: " << sizeof(short) << endl;cout << "the size of int is: " << sizeof(int) << endl;cout << "the size of long is: " << sizeof(long) << endl;cout << "the size of long long is: " << sizeof(long long) << endl;cout << "the size of float is: " << sizeof(float) << endl;cout << "the size of double is: " << sizeof(double) << endl;cout << "the size of long double is: " << sizeof(long double) << endl;
输出
var_int_min: -1var_int_max: 2147483647the size of bool is: 1the size of char is: 1the size of wchar_t is: 2the size of char16_t is: 2the size of char32_t is: 4the size of short is: 2the size of int is: 4the size of long is: 4the size of long long is: 8the size of float is: 4the size of double is: 8the size of long double is: 8
How to get the type of a variable or a literal?
source
use typeid operator
#include <typeinfo>...cout << typeid(variable).name() << endl;
extern和include的用法区别???
extern_test.h
int ext = 0;
source.cpp
#include "extern_test.h"#include <iostream>
using namespace std;int main() {cout << ext << endl;return 0;}
两个文件,source只要include.h文件,就能正常使用ext. extern声明在什么情况下用?
0 0
- c点滴
- c 点滴
- C/C++使用点滴
- c语言指针点滴
- 嵌入式C语言点滴
- C学习点滴
- C语言点滴
- C语言点滴
- c语言基本知识点滴
- C语言点滴
- 点滴积累【C#】
- C基础点滴
- 《C语言点滴》书评
- C编程点滴
- C&C++点滴
- C语言点滴记录
- C语言点滴
- C语言点滴
- deque
- 跳槽季,你准备好了吗(一)?
- Android组件化方案
- 利用struts2技术----上传图片
- JForum论坛安装及配置
- C++点滴
- 迷失の搜索树
- nginx学习(1):编译、安装、启动
- 编程之美:求二进制中1的个数
- android应用程序如何调用支付宝接口
- 使用wait和notify实现经典生产者消费者问题
- 一步一步打造我的第一个Android应用之缘起Android
- nginx安装总结
- 扣减库存策略采用订单是否锁定库存方案