码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
精简Linux文件路径
精简Linux的文件路径: ..回退的功能.留在当前目录//只保留一个/abc/..要返回.报错删除最后一个/ 主要思路: 用栈记录路径的起始位置,讨论/后的不同情况即可: #include #include #include #include #include #include using namespace std; int selectK(int num[]...
分类:系统相关   时间:2014-07-22 23:01:32    阅读次数:384
[c++]this指针理解
#include using namespace std;/** * this 指针理解 */class A{ int i;public: void hello(){ couthello();}由于单独开发基于c++的编译器,c++程序翻译成c程序后在,在使用c语...
分类:编程语言   时间:2014-05-12 16:34:20    阅读次数:283
c++容器学习
转:http://blog.csdn.net/zhanghaodx082/article/details/179194011,using学习 两种方式:第一,完全引入命名空间y,如,using namespace std; 以后要用std中定义的符号就方便了,如cin>> ; 第二,只引入要用的符号...
分类:编程语言   时间:2014-05-12 16:28:15    阅读次数:340
nefu 640 Number Guessing
题目:大意就是猜数,给定个四位数,然后给出这个数与正确的数之间的比较(#A*B,#代表有#个数字他的值和位置都对了,*代表有*个数的值对了),给出n个上述的4位数,让你确定这个正确的数是多少。 思路:直接暴力。 注意:程序结束是n为负数,而不是-1,为此超时了两次 T T。 代码: #include #include #include using namespace std; str...
分类:其他好文   时间:2014-05-02 21:16:30    阅读次数:314
二分图匹配
HDU  2063  求一个二分图的最大匹配。 完全的裸题。贴代码。 #include #include #include #include #include using namespace std; vector G[1005]; bool check[1005]; int mac[1005]; int n; void add_edge(int from,int to) { G[f...
分类:其他好文   时间:2014-05-02 20:57:04    阅读次数:359
拷贝构造函数[c++]
拷贝构造函数何时会被调用?1. 对象以值传递的方式传入函数参数2.对象以值传递的方式从函数返回3.对象需要通过另外一个对象进行初始化下面我们来看代码://#include //using namespace std;//template //T:队列的类型,char,int,double,包括自己....
分类:编程语言   时间:2014-05-02 17:33:17    阅读次数:401
void f(int(&p)[3]){} 和void f(int(*p)[3]){}的区别
#include using namespace std; void f(int(&p)[3]){          cout     cout } int main(){     int a1[3]={1,2,3};     cout     cout     f(a1); } 编译后输出:...
分类:其他好文   时间:2014-05-02 05:32:02    阅读次数:265
串的模式匹配算法(KMP)
算法: #include using namespace std; #define MAXSIZE 100 void calNext(const char *T,int *next);//T为模式串,next为预判数组 int kmp_match(const char *S,const char *T);//在主串S中寻找模式串T,如果找到返回其位置,否则返回-1。位置从0开始 void ...
分类:其他好文   时间:2014-05-02 02:25:40    阅读次数:280
求数组的子数组之和的最大值?
自己写的代码考虑未周全,引入了额外的空间复杂度://求数组的子数组之和的最大值#include #define N 12using namespace std;int main(){ //int a[]={-5,2,3,-3,-2,3,1,-5}; //int a[]={-5,2,0,3...
分类:其他好文   时间:2014-05-02 01:59:35    阅读次数:254
C++ Primer 学习笔记_52_类与数据抽象 --构造函数【下】
类--构造函数【下】二、默认实参与构造函数一个重载构造函数: Sales_item():units_sold(0),revenue(0){} Sales_item(const std::string &book): isbn(book),units_sold(0),revenue(0) {} 可以通过给string初始化式提供一个默认实参将这些构造函数组合起来: ...
分类:编程语言   时间:2014-05-01 08:17:52    阅读次数:386
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!