上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: #include "stdafx.h"#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ /****const 指针****/ const double pi = 3.14; //double *p = &pi;//错误,const对象的地址只能传给 指向const对象 的指针 const double *p = 0; p = &pi; //*p += 1.4;//错误,不能通过 指向const对象的指针 修改 const对象 的值 double 阅读全文
posted @ 2011-10-25 13:44 韩冬冬 阅读(243) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include <iostream>#include <vector>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ /****数组用法****/ int iar[6] = {-12,-2,0,8,5,4}; vector<int> ivec(10,3); vector<int> ivec1(iar+1,iar+4); vector<int> ivec2(ivec1); vector<int>:: 阅读全文
posted @ 2011-10-25 13:43 韩冬冬 阅读(522) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include <iostream>#include <bitset>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ bitset<32> bitvec(8); bool flag = bitvec.any();//判断是否存在某位或者多位为1,有则返回true bool flag1 = bitvec.none();//判断是否所有的位都是0,是则返回true bool flag2 = bitvec.test(3);//测试第4位是 阅读全文
posted @ 2011-10-25 13:42 韩冬冬 阅读(471) 评论(0) 推荐(1) 编辑
摘要: char cal1[] = {'C','+','+'};//维数是3 char cal2[] = "c++";//维数是4 //char cal3[] = cal1;//不能用一个数组初始化另一个数组 //char &cal4[] = {'C','+','+'};//c++不允许数组引用----------------------------------------------------------string *ps = new string("Hello 阅读全文
posted @ 2011-10-25 13:35 韩冬冬 阅读(195) 评论(0) 推荐(0) 编辑
摘要: dynamic_cast:通常在父类与子类之间转化时使用,转化的类型和对象都是类对象,不能应用于c++内置类型static_cast:一般的类型转换,但不能将一个const对象转型为non-const对象(只有const_cast能做到)。const_cast:将一个const对象转型为non-const对象;reinterpret_cast:通常对于操作数的位模式执行一个比较低层次的重新解释。 阅读全文
posted @ 2011-10-25 13:29 韩冬冬 阅读(162) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页