- 博客(19)
- 资源 (6)
- 收藏
- 关注
转载 vector
在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。1 基本操作(1)头文件#include.(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout(5)使用迭代器访问元素.vectorint>::iterator it;for(it=vec.begin();it
2016-06-18 10:44:37 307
原创 C 结构体
struct s_A{char a[10];int b;};struct s_A A[5];memset(&A,0,sizeof(s_A)*5);A[1].b=100;struct s_A ** A;A = (struct s_A**)malloc(sizeof( s_A)*10);for(i=0;i{A [i]= (struc
2016-03-28 09:45:53 349
转载 CWIN消息机制
#include #include // 全局变量RECT rc; //记录滚屏的矩形区域int xChar, yChar; //文本输入点坐标WNDCLASSEX wnd; //窗口类结构变量char szAppName[] = "键盘消息监视程序"; //窗口类名//函数声明LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM)
2016-03-28 09:33:31 867
转载 C tree
#include #include #include #include #includetypedef struct NODE{ int id; char name[10]; struct NODE *NextNode;}Node;Node *NodeInit(){ Node *pNode ; pNode = (Node *)malloc(sizeof(struct
2016-03-28 09:29:00 466
转载 Socket
// server.cpp #include #include #include #pragma comment(lib,"Ws2_32.lib") using namespace std; int main() { // 加载socket动态链接库(dll) WORD wVersionRequested; WSADATA w
2016-03-28 09:26:01 348
原创 apache 开启 server-status 和server-info模块
1、在htppd.conf文件中找到 #LoadModule status_module modules/mod_status.so和 #LoadModule info_module modules/mod_info.so ,去掉前面的#号2、在末尾(或者其他不影响其他块结构的地方),添加下code:#-Apache Server Status--------------#Exte
2015-01-20 14:52:42 1018
原创 win7 C++配置zeromq
1.下载安装zeromq: http://zeromq.org/distro:microsoft-windows,点 x64 build for Vista, 7, 8, Windows Server 2008 R2 and newer.可以下载一个exe文件,顺序安装2.建立空项目,x64,release(debug),按照网址的列表选择dll和lib文件,dll文件在bin中3.
2014-12-31 12:38:04 878
原创 C/C++ 控制台打飞机游戏
#include #include #include #include #define N 35void print(int [][N]);//输出函数void movebul(int [][N]);//子弹移动函数void movepla(int [][N]);//敌机移动函数void setting(void);//设置函数void menu(void);/
2014-12-29 10:47:25 8225 2
原创 C++中exe传参数给另外一个exe
1.传递参数的exe,参数在s中,以空格隔开#include #include #include using namespace std;int main(int argc,char *argv[]){coutstring s;getline(cin,s);HINSTANCE hNewExe1 = ShellExecuteA(NULL, "o
2014-12-25 11:11:33 1697
原创 VC++复制文件
#include #include using namespace std;int CopyFile(string SourceFile,string NewFile){ifstream in;ofstream out;in.open(SourceFile,ios::binary);//打开源文件if(in.fail())//打开源文件失败{cout
2014-12-22 10:51:58 398
转载 字符串分割(C++)
经常碰到字符串分割的问题,这里总结下,也方便我以后使用。一、用strtok函数进行字符串分割原型: char *strtok(char *str, const char *delim);功能:分解字符串为一组字符串。参数说明:str为要分解的字符串,delim为分隔符字符串。返回值:从str开头开始的一个个被分割的串。当没有被分割的串时则返回NULL。其它:strtok函数
2014-12-17 16:21:40 437
原创 win7 C++ImageMagick配置
1.先说下我的系统: win7 64位,下载的是ImageMagick-6.8.9-Q16.rar,程序在release,win32下。2. Imagemagick顺序安装,不过在选择额外功能时候,选择前4个,特别是那个c,c++库3.建立release win32空项目,在项目属性中:VC++目录包含目录 添加 E:\Visual Studio\ImageMagick-6.8.9\I
2014-12-15 11:13:44 746
原创 C++写cgi 获取网页ur问号后的内容
cgi 的运行离不开apache 的cgi-bin,配置好apache再看这个char *url;char q[100];char p[100];couturl = getenv("QUERY_STRING");if(url == NULL){//couterror!no data!"//return 0;}else if(sscanf(url,"q
2014-12-15 11:11:07 635
原创 C++ 连接mysql 数据库,以及query语句
C++ 连接mysql数据库,首先要有头文件 #include #include ,Windows.h要在mysql.h之前1、下载安装mysql 注意是32位还是64位的2、新建程序,在项目属性->VC++ 目录->包含目录中添加 E:\MySQL_32\MySQL Server 5.6\include 在项目属性->VC++ 目录->库目录中添加E:\MySQL_32\MyS
2014-12-15 10:52:59 1355
原创 C++中的时间函数
1.用于获取当前系统时间Format 可按格式输出CTime time = CTime::GetCurrentTime();string str = time.Format("%Y-%m-%d %H:%M:%S");2. 用于秒级别的运算,一般用于函数观察程序运行时间,优化#Include double t 1= clock(); double t2 = cl
2014-12-15 10:45:59 359
原创 c++关于字符串的替换
在c Java语言中,有replace 这个函数,可以用于字符串替换,但是c++却没有类似的功能str 要处理的字符串 pattern 要替换的字符串 dstPattern 替换成为的字符串 count 替换个数#include #include using namespace std;string m_replace(string str,string patt
2014-12-15 10:42:45 541
原创 c\c++字符串以数字,字母分开,并且存入数组
string a;int c[20]={0}string b[20]={""};int j=0,m=0;bool b_str=false;bool b_int = false;for(int i=0;i{if(a[i]>='a' &&a[i]{if(b_str){b[j] = b[j] +a[i] ;}else{b[j] = a
2014-12-15 10:40:56 4883
原创 C/C++字符串以某个标识符分开并存入数组
如 s ="我的博客,不,是你的博客“按逗号分开就是一个数组: 我的博客 不 是你的博客 ,3个元素string s; //需要处理的字符串char list[10][20]={0};char rule[] = ",";char *token;int tmplen=0;int offset=0;int num=0;char *c;
2014-12-15 10:35:28 714
原创 win7设置NFS共享目录
第一次写,不好别见怪!1.首先在网上下载NFSServer ,下载网址为: http://www.xiazaiba.com/html/1385.html ,直接安装即可2.在 NFS服务器的输出选项中,编辑输出表文件,直接在下面添加要设置共享的目录,如 c:\nfs - public3.运行cmd ,输入 showmount -e IP ,会显示挂载目录(记得在服务里面打开NFS
2014-12-15 10:17:27 1269
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人