C++
DiffenYu
这个作者很懒,什么都没留下…
展开
-
MinGw的介绍和使用
转至http://blog.csdn.net/k1988/article/details/4375382,此博客也是转载他人,但没有指明源出,对文中错误之处进行了适当的修改3.1:MinGW 是什么? MinGW 提供了一套简单方便的Windows下的基于GCC 程序开发环境。MinGW 收集了一系列免费的Windows 使用的头文件和库文件;同时整合了GNU (转载 2012-12-03 20:01:30 · 1289 阅读 · 0 评论 -
C++学习方法
转至微薄,mark一下:一个学习C++的方法,适合有一定基础的同学。先读effective c++,一天能搞定(从c转读第二版,从java等转读第三版),然后读google c++ style。再是看leveldb代码(http://t.cn/aYyqjo 多谢@apc2 推荐),Sanjay和Jeff所写,简短完备,非常优美,完美阐述前两者所列的原则。原创 2013-05-12 12:30:44 · 850 阅读 · 0 评论 -
C++ Primer Chapter 9 循环将list元素逆序输出
#include #include #include #include #include #include #include using namespace std;int main (){#if 1 list > s; int iarray[] = {1, 2, 3, 4, 5}; list ilist(iarray, iarray + 5); for (list:原创 2013-01-31 13:30:06 · 2332 阅读 · 1 评论 -
C++ Primer Chapter 9 利用内置数组中一对指针初始化容器
#include #include #include #include #include #include #include using namespace std;int main (){ char* pwords[] = {"qa", "w","e","r"};//此处是字符串指针数组 char words[] = {'q','w','e'}; //char word原创 2013-01-31 10:12:22 · 1204 阅读 · 0 评论 -
C++ Primer Chapter 11 generic algorithm
#if 0//chapter11 Exercise 11.1#include #include #include #include using namespace std;int main (){ vector ivec; int ival; cout << "Enter some integers(Ctrl + z to end): " << endl; while原创 2013-03-01 21:37:55 · 1210 阅读 · 0 评论 -
C++ Primer Chapter 10 关联容器之set & mutimap
#if 0//Chapter 10 Exercise 10.24//此程序在dos下输入test.exe exfile.txt//exfile.txt 中存放的是排除集单词#include #include #include #include using namespace std;ifstream& open_file(ifstream& in, const string&原创 2013-03-17 22:48:07 · 1107 阅读 · 0 评论 -
C++ Primer Chapter 10 关联容器之容器的综合应用:文本查询程序
//TextQuery.h#ifndef _TEXTQUERY_H_#define _TEXTQUERY_H_#include #include #include #include #include #include class TextQuery{public: typedef std::vector::size_type line_no; void read_fil原创 2013-03-17 22:55:45 · 1421 阅读 · 0 评论 -
C++ Primer Chapter 10 关联容器之map
//Chapter 10#if 0//Chapter 10 Exercise 10.1~2#include #include #include #include #include using namespace std;int main(){#if 0 //version 1 string sdata; int idata; pair sidata; vecto原创 2013-03-15 20:09:18 · 1311 阅读 · 0 评论 -
头文件string,string.h,cstring的器区别和联系
/************************************************************************//*一般的C++的.h头文件在新标准库中都有一个不带'.h'的扩展名相对应,后者对前者有了改进,并送至了std命名空间/*string并不是string.h的改进扩展,在C中已经有了一个string.h的头文件,有着诸如strcmp,strcat等原创 2012-12-14 11:09:49 · 723 阅读 · 1 评论 -
C++类测试运行时间
MyClock.h#ifndef MY_CLOCK_H#define MY_CLOCK_H#include class MyClock{private: long m_lBegin; long m_lEnd; double m_dTime; static double sm_dTotalTime;//将sm_lTotalTime化为秒单位 static long s原创 2013-01-12 19:16:44 · 721 阅读 · 0 评论 -
static数据成员、成员函数的问题
http://blog.csdn.net/zxxyyxf/article/details/6432612错误提示:pure specifier can only be specified for functions问题原因:不能在类里边赋static数据成员的初值错误提示:'static' should not be used on member functions d转载 2013-01-12 17:29:29 · 1258 阅读 · 1 评论 -
C++编码规范与指导
http://baiy.cn/doc/cpp/index.htm转载 2013-01-12 16:44:10 · 664 阅读 · 0 评论 -
fstream的使用方法介绍
来源:http://www.cppblog.com/saga/archive/2007/06/19/26652.html在C++中,有一个stream这个类,所有的I/O都以这个“流”类为基础的,包括我们要认识的文件I/O,stream这个类有两个重要的运算符:1、插入器( 向流输出数据。比如说系统有一个默认的标准输出流(cout),一般情况下就是指的显示器,所以,cout转载 2013-01-24 21:43:49 · 503 阅读 · 0 评论 -
C语言中的随机函数rand()
#if 1#include #include #include #include #include using namespace std;int main(){ int nRandNumber[10]; for (int idx = 0; idx < 10; ++idx) { nRandNumber[idx] = rand();//取随机数范围为integer 0 ~原创 2013-01-24 19:36:15 · 2031 阅读 · 0 评论 -
cin、cin.get()、cin.getline()、getline()、gets()函数的用法
1、cin>> 用法1:最基本,也是最常用的用法,输入一个数字:#include using namespace std;main (){int a,b;cin>>a>>b;cout}输入:2[回车]3[回车]输出:5用法2:接受一个字符串,遇“空格”、“TAB”、“回车”都结束#include using namespace std;m转载 2012-12-15 11:06:45 · 948 阅读 · 1 评论 -
assert()详解
assert()是什么?assert的头文件是assert.h使用方式:assert( expression );当expression为FALSE时,程序将会终止,并且会弹出expression的信息。光这样说可能不太清楚。for exampleassert(length >= 0);//当length小于0时,程序将会终止,并弹出Assersion failed:原创 2013-05-30 19:38:17 · 1676 阅读 · 0 评论