2016年9月11日

c++异常捕获

摘要: #include <iostream> #include <string> using namespace std; int main() { try { int value1,value2; //定义两个整型变量 cout<<"Pleaseinput two value:"<<endl; //提示 阅读全文

posted @ 2016-09-11 21:17 邗影 阅读(630) 评论(0) 推荐(0)

C++链表

摘要: 复习到链表,写一个 这里一直困惑我的是&。。。本来认为&相当于*,,,,,,取内容,取地址。。。 但是写完了发现不是的,,,*&!=&(node *p); 他的意思只是说函数里我需要的是这个参数的引用,而不是副本。要的是目标本身。。 由于写中间插入删除要考虑前向指针,所以写个简单的,自己复习一下,, 阅读全文

posted @ 2016-09-11 17:32 邗影 阅读(265) 评论(0) 推荐(0)

c++泛型模板

摘要: 模板是C++支持参数化多态的工具,使用模板可以使用户为类或者函数声明一种一般模式,使得类中的某些数据成员或者成员函数的参数、返回值取得任意类型。 模板是一种对类型进行参数化的工具; 通常有两种形式:函数模板和类模板; 函数模板针对仅参数类型不同的函数; 类模板针对仅数据成员和成员函数类型不同的类。 阅读全文

posted @ 2016-09-11 15:30 邗影 阅读(939) 评论(0) 推荐(0)

2016年9月10日

c++ stl常用

摘要: #include<iostream> #include<string> #include<vector> #include<list> #include<set> #include<iterator> #include<map> #include<fstream> #include <string> 阅读全文

posted @ 2016-09-10 21:38 邗影 阅读(208) 评论(0) 推荐(0)

c++流操作

摘要: 非缓冲标准出错流对象cerr和缓冲标准出错流对象clog,它们都是来自于ostream类的对象,用于输出错信息。cerr和clog之间的不同之处在于cerr是不经过缓冲区直接向显示器输出有关信息,而clog则是先把信息放在缓冲区,缓冲区满后或遇上endl时向显示器输出。 转载 http://www. 阅读全文

posted @ 2016-09-10 20:06 邗影 阅读(707) 评论(0) 推荐(0)

操作符重载operator

摘要: 发现一篇好文: 转载: http://chuna2.787528.xyz/xiehongfeng100/p/4040858.html #include <iostream>#include <time.h>using namespace std;class C{public: int real; int 阅读全文

posted @ 2016-09-10 10:34 邗影 阅读(626) 评论(0) 推荐(0)

2016年9月9日

函数指针和指针函数

摘要: #include <iostream> using namespace std; int (*ptr)(int a,int b);int fun(int x,int y){ int z; z=x>y?x:y; return z; } int fun3(int a){//传的是副本 cout<<"** 阅读全文

posted @ 2016-09-09 20:07 邗影 阅读(255) 评论(0) 推荐(0)

指针c艹

摘要: #include <iostream> using namespace std;int value=1;void func(int *p){ p=&value; }void func(int **p)。。。。。。。重载{ *p=&value; }int main(){ int a=3; int *p 阅读全文

posted @ 2016-09-09 19:11 邗影 阅读(185) 评论(0) 推荐(0)

汉诺塔,水仙花

摘要: #include <iostream> using namespace std; void hanno(char a,char b,char c,int s){ if(s==1) { cout<<a<<" "<<c<<endl; return; } else{ hanno(a,c,b,s-1); c 阅读全文

posted @ 2016-09-09 14:04 邗影 阅读(177) 评论(0) 推荐(0)

2016年9月7日

c++继承赋值兼容

摘要: 其实还是不明白,红色部分,,,求解 #include <iostream>#include <time.h>using namespace std; class B0{public: void display() { cout<<"B0::display()"<<endl; }}; class B1 阅读全文

posted @ 2016-09-07 21:31 邗影 阅读(280) 评论(0) 推荐(0)

导航