![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++学习
文章平均质量分 62
刘璨瑞
这个作者很懒,什么都没留下…
展开
-
sort用法示例
#include#include using namespace std;bool compare(const int a,const int b){return a>b;}int main(){int seg[10];for (int i=0;i{seg[i]=i;}sort(seg,seg+10,compare);for (int i=0;i{cout}return 0;}原创 2011-03-03 23:10:00 · 402 阅读 · 0 评论 -
_stricmp
stricmp 原型:extern int stricmp(char *s1,char * s2); 用法:#include 功能:比较字符串s1和s2,但不区分字母的大小写。 说明:strcmpi是到stricmp的宏定义,实际未提供此函数。 当s1 当s1=s2转载 2011-07-13 10:48:14 · 7849 阅读 · 1 评论 -
strtol
strtol long int strtol(const char *nptr,char **endptr,int base);函数的解释说明 这个函数会将参数nptr字符串根据参数base来转换成长整型数。参数base范围从2至36,或0。参数base代表采的进制方式,如b转载 2011-07-13 11:09:22 · 541 阅读 · 0 评论 -
_strdup 的使用
strdup 原型:extern char *strdup(char *s); 头文件:#include 用法:char *strdup(char *s); 功能:复制字符串s 说明:返回指向被复制的字符串的指针,所需空间由malloc()分配且可以由free()释放转载 2011-07-13 10:47:05 · 4415 阅读 · 0 评论 -
strtok
原型 char *strtok(char *s, const char *delim);编辑本段功能 分解字符串为一组字符串。s为要分解的字符串,delim为分隔符字符串。编辑本段说明 首次调用时,s指向要分解的字符串,之后再次调用要把s设成NULL。 strtok在s中转载 2011-07-13 11:06:16 · 621 阅读 · 0 评论 -
_strlwr转小写
_strlwr 原型:extern char *strlwr(char *s); 用法:#include 功能:将字符串s转换为小写形式 说明:只转换s中出现的大写字母,不改变其它字符。返回指向s的指针。 举例: // strlwr.c #include #i转载 2011-07-15 16:07:35 · 1005 阅读 · 0 评论 -
如何让VS2005显示行号 和 语句块的折叠展开
如何让VS2005显示行号 和 语句块的折叠展开工具(Tools)-->选项(Options)-->单击右侧→文本编辑器(Text Editor)-->其下面“所有语言(All Languages)”-->常规-->显示(Display)-->行号(Li转载 2011-09-07 15:35:05 · 2782 阅读 · 1 评论 -
编辑器Ultraedit快捷键
编辑器Ultraedit快捷键说到编辑器的快捷键,VIM是无与伦比的。要反对,也得是带脚踏板的EmaCS。UE还是有差距的,很大差距。注意:VIM是开源、免费的,而UE则需要 注册。UE是Windows下最好的编辑器——如果没有GVIM和Emacs的话。而VIM和转载 2011-10-12 16:19:23 · 778 阅读 · 0 评论 -
买了手机想很多
关注手机有好一段时间,最后近乎疯狂,工作变得无心。唉,其实现在想想也不必这样。我使用手机也就再乎他的导航。 工作状态变得好差劲,无心学习了。不管了啊!管它的垃圾手机。随便买个个htc thunderbolt 霹雳。再也不管原创 2011-10-10 10:45:12 · 508 阅读 · 0 评论 -
c++笔记
c++笔记2011年01月14日 星期五 7:24parameter 参数 semicolon 分号 colon 冒号 argument 实参 comment 注释 curly brace 花括号 有符号整型中其中一位作为符号位,1表示负数。求模不是取余,if(a>b) {不断从a中减去一个b,直到出现一个小于b的非负数} else if {a转载 2012-01-29 13:58:53 · 1973 阅读 · 0 评论 -
Effective C++读书笔记
Effective C++读书笔记(50条款)2008-07-13 10:431.为方便调试,最好使用常量。注意:常量定义一般放在头文件中,可将指针和指针所指的类型都定义成const,如const char *const authorName = “Scott Meyers”;类中常量通常定义为静态成员, 而且需要先声明后定义。可以在声明时或定义时赋值,也可使用借用enum的方法。转载 2012-01-29 15:38:49 · 470 阅读 · 0 评论 -
大数相关poj1001
// go.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include#include#include#includeusing namespace std;//const long base = 10000;class BigInteger{public: Big转载 2012-04-04 15:21:20 · 461 阅读 · 0 评论 -
poj1002
#include #include #include #include #include using namespace std;int main(){ freopen("in.txt","r",stdin); int N; cin >> N; vector vNumCode; for (int i=0; i<N; i++) { string strInput;转载 2012-04-05 09:25:59 · 348 阅读 · 0 评论 -
poj1002
#include #include int number[10000000]; //号码放入哈希表中int main(){ freopen("in.txt","r",stdin); int b,d=0,e,n,i=0,j=0; char a[10000]; memset(number,0,sizeof(number)); scanf("%d",&n);转载 2012-04-05 09:39:43 · 407 阅读 · 0 评论 -
设计模式C++学习笔记之一(Strategy策略模式)
设计模式C++学习笔记之一(Strategy策略模式)无意中,从网上下到一本电子书《24种设计模式介绍与6大设计原则》,很好奇这里有24种设计模式,印象中GOF写的《设计模式》(Design Patterns),好像只有23种吧。运行起来一看,还真挺吸引咱的,里面提到的例子都很有趣。很感谢作者写出这样好的例子来,我的目的是把作者提到的例子用C++来实现。写这本书的作者是:cbf4lif转载 2012-04-05 22:25:11 · 628 阅读 · 0 评论 -
std list/vector sort 排序
class TestIndex{public: int index; TestIndex(){ } TestIndex(int _index):index(_index){ } bool operator()(const TestIndex* t1,const TestIndex* t2){ printf("Operator():%d,%d/n",t1->index,t2->in转载 2012-04-07 22:38:15 · 3963 阅读 · 0 评论 -
C++学习之map类型
C++学习之map类型分类: 学习C++2011-06-15 10:49 90人阅读 评论(0) 收藏 举报1。目录map简介map的功能map的定义在map中添加元素查找并获取map中的元素从map中删除元素map对象的迭代遍历 2。map简介map是一类关联式容器,它是模板类转载 2011-07-07 17:46:36 · 59647 阅读 · 4 评论 -
关于函数指针和typedef
例子1:测试普通的函数指针。int testfun(int m, int n){ printf("testfun:m=%d,n=%d/n",m,n); return 0;}int main(){ int a = 8; int转载 2011-07-06 11:30:21 · 387 阅读 · 0 评论 -
find示例
<br />#include <iostream>#include <algorithm>using namespace std;#define SIZE 100int iarray[SIZE];int main(){ iarray[20] = 50; int* ip = find(iarray, iarray + SIZE, 50); printf("%d/n",ip-iarray); if (ip == iarray + SIZE) cout << "50原创 2011-03-03 23:27:00 · 319 阅读 · 0 评论 -
bsearch示例
<br />#include<iostream>#include<stdlib.h>using namespace std;int compare(const void*a,const void *b){ return *((int*)a)-*((int*)b);}int main(){ int ar[100],i; for(int i=0;i<100;i++) ar[i]=i+10; i=22; int *p; if(p=(int*)bsearch原创 2011-03-03 23:45:00 · 508 阅读 · 0 评论 -
vc++指针
<br /> VC++讲义--第05单元 函数 VC++讲义--第07单元 类与对象(I)VC++讲义--第06单元 指针<br />软件开发 2007-04-24 14:25:49 阅读100 评论0 字号:大中小 订阅<br /> <br />第6单元 指针<br />本单元教学目标<br />介绍C++中指针的基本概念。<br />学习要求<br />指针是C++中最重要的基本概念之一。要求同学们充分理解和掌握:<br />1.什么是地址? 什么是指针?<br />2.指针类型变量的声明方法和怎样转载 2011-03-08 16:10:00 · 4661 阅读 · 0 评论 -
VC编译错误: libcmt.lib 已经定义
<br />VC编译错误:uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) 已经在 LIBCMT.lib(new.obj) 中定义<br />编译错误 2010-03-30 21:47:54 阅读1801 评论0 字号:大中小 订阅<br />1>uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl o转载 2011-05-30 09:06:00 · 5600 阅读 · 1 评论 -
Vs2005下重复定义的问题解决
<br />Vs2005下重复定义的问题解决 ... already defined in ...<br />IT笔记 2009-06-05 10:49:54 阅读166 评论0 字号:大中小 订阅<br />这几天为VS2005 LINK 2005 ... already defined in ...的问题烦死了,调试了几天,仍然还没能有效地解决,特在网上转载一篇文章,谨供参考,留作纪念。<br />方案一、<br />编程中经常能遇到LNK2005错误——重复定义错误,其实LNK2005错误并不是一个转载 2011-05-30 09:09:00 · 1938 阅读 · 1 评论 -
c++ 数据封装模式之一: 简单工厂模式
c++ 数据封装模式之一: 简单工厂模式时间:2009-12-03 21:53:06来源:网络 作者:未知 点击:212次// SimpleFactory.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "ostream.h"转载 2011-06-05 13:52:00 · 671 阅读 · 0 评论 -
c++ 数据封装模式之三: 抽象工厂模式
// AbstractFactory.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "ostream.h" //定义抽象类 class CAnimal { protected:转载 2011-06-05 13:58:00 · 354 阅读 · 0 评论 -
c++ 数据封装模式之一: 简单工厂模式
// SimpleFactory.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "ostream.h" //定义抽象类 class CAnimal { protected:转载 2011-06-05 13:52:00 · 724 阅读 · 0 评论 -
c++ 数据封装模式之二: 工厂方法模式
// FactoryMethod.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "ostream.h" //定义抽象类 class CAnimal { protected:转载 2011-06-05 13:56:00 · 459 阅读 · 0 评论 -
c++ 数据封装模式之四: 观察着工厂模式
// Observer.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "ostream.h" #include <afxcoll.h> //定义抽象观察者角色 class CObs转载 2011-06-05 14:05:00 · 494 阅读 · 0 评论 -
头文件保护符和#pragma once
利用VC的AppWizard一般会生成如下代码:#if !defined(AFX_***_H__A06FACFB_DE47_4BCD_ABB3_3AE66C6D9765__INCLUDED_)#define AFX_***__A06FACFB_DE47_4BC转载 2011-07-06 11:42:08 · 999 阅读 · 1 评论 -
代码测试----不定参函数
#include #include void MyPrintf(char *format, ...) { va_list ap; va_start(ap, format); vprintf(format, ap);转载 2011-07-06 11:31:25 · 333 阅读 · 0 评论 -
DLL详解
DLL文件(Dynamic Linkable Library 即动态链接库文件),是一种不能单独运行的文件,它允许程序共享执行特殊任务所必需的代码和其他资源 比较大的应用程序都由很多模块组成,这些模块分别完成相对独立的功能,它们彼此协作来完成整个软件系统的工作转载 2011-07-06 11:40:48 · 316 阅读 · 0 评论 -
c++继承经典例子
c++继承经典例子#include class Base{private: int b_number;public: Base( ){} Base(int i) : b_number (i) { } int get_numb转载 2011-07-07 17:13:17 · 590 阅读 · 0 评论 -
接口继承和实现继承
C++箴言:接口继承和实现继承 (public) inheritance 这个表面上简单易懂的观念,一旦被近距离审视,就会被证明是由两个相互独立的部分组成的:inheritance of function interfaces(函数接口的继承)和 inheritance of f转载 2011-07-07 17:13:44 · 984 阅读 · 0 评论 -
转 error C2471: 无法更新程序数据库
平:今天程序中的一个项目出现了 error C2471 错误。上网搜索一下,下面这个方法可以解决问题。转载一下做记录error C2471: 无法更新程序数据库“d:/Work/ Project/FBReader/debug/vc90.pdb” fatal error C1083: 无法打开程序数据库文件:“d:/Work/ Project/FBReader/debug转载 2013-04-26 14:44:18 · 1001 阅读 · 1 评论