![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++ 语言基础
tianshi182011
这个作者很懒,什么都没留下…
展开
-
C++ 全局变量与局部变量
/****Lession1.h****/ extern bool a; extern int b; extern float c; extern double d; extern unsigned int e; extern long f; extern unsigned long g; extern char h; extern long double i; /**...2010-10-15 20:44:33 · 147 阅读 · 0 评论 -
c++ const 指针与引用
#include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { /****const 指针****/ const double pi = 3.14; //double *p = &pi;//错误,const对...2010-10-15 20:58:33 · 66 阅读 · 0 评论 -
vector 使用方法
#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&l...2010-10-16 09:21:40 · 93 阅读 · 0 评论 -
bitset 操作
#include "stdafx.h" #include <iostream> #include <bitset> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { bitset<32> bitvec(8); bool flag = bitvec.any();//判...原创 2010-10-16 09:26:48 · 104 阅读 · 0 评论 -
基础总结 锦集
char cal1[] = {'C','+','+'};//维数是3 char cal2[] = "c++";//维数是4 //char cal3[] = cal1;//不能用一个数组初始化另一个数组 //char &cal4[] = {'C','+','+'};//c++不允许数组引用 string *ps = new string("Hello World!...2010-10-16 09:46:02 · 67 阅读 · 0 评论 -
c++ 强制类型转化
dynamic_cast:通常在父类与子类之间转化时使用,转化的类型和对象都是类对象,不能应用于c++内置类型static_cast:一般的类型转换,但不能将一个const对象转型为non-const对象(只有const_cast能做到)。const_cast:将一个const对象转型为non-const对象;reinterpret_cast:通常对于操作数的位模式执行一个比较低层次的重新解释。...2010-10-16 10:19:12 · 80 阅读 · 0 评论 -
c++ 异常处理
#include "stdafx.h" #include <iostream> using namespace std; enum EHstate{ noErr, zeroOP,nega, severeError}; enum EHstate state = noErr; int mathFunc(int i) { if(i == 0) { throw s...2010-10-23 10:09:44 · 93 阅读 · 0 评论