
C++
Kayee2012
这个作者很懒,什么都没留下…
展开
-
【C++】字符串模糊匹配
原文出处:http://www.cnblogs.com/Creator/archive/2013/03/25/2981186.html需求: 准入授权配置文件有时候分了好几个维度进行配置,例如 company|product|sys这种格式的配置:1.配置 "sina|weibo|pusher" 表示 sina公司weibo产品pusher系统能够准入,而"sina|weibo|si转载 2013-03-27 14:04:09 · 1523 阅读 · 0 评论 -
【C++】封装使用jsoncpp的类
封装使用jsoncpp的类包括5种功能1.是否存在节点 bool IsNodeExisted(string jsonObj, string strNode); 2.为数组增加元素 int AppendArrayObject(string& jsonObj, string strNode, string strValue);3.获取节点值 int原创 2014-02-26 18:29:34 · 5522 阅读 · 2 评论 -
【C++】删除顺序容器(如:vector)中的重复字符串
#include #include #include #include using namespace std;int main(int argc, const char * argv[]) { stringstream sentence("the quick red fox jumps over the slow red turtle");原创 2013-01-16 17:25:03 · 2298 阅读 · 0 评论 -
【C++】查询、创建、设置注册表键值的示例代码
示例代码将在注册表位置:HKEY_CURRENT_USER\Software\ 读写键值bool LicenseManage::OpenRegKey(HKEY& hRetKey){ if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,"Software", &hRetKey)) { return true;原创 2014-04-29 14:44:36 · 5962 阅读 · 0 评论 -
【C++】关于sort()的使用
头文件:#include 例子如下:#include #include #include using namespace std;int main(){ string a[] = {"123", "124","112","102","111"}; sort(a, a+5); for (int i = 0; i < 5; i++)原创 2012-12-18 14:19:41 · 509 阅读 · 0 评论 -
【C++】链表学习
#include "stdafx.h"#include using namespace std;typedef struct Node{ int nVal; Node *pNext;}Link,*pLink;Link * CreateLink(int arr[], int n){ if (0 == n) { return NULL;原创 2014-08-19 10:14:36 · 604 阅读 · 0 评论 -
【C++】顺序容器 Vector 注意事项
引用头文件#include 一、操作数据主要有下列几种方式: vector vecSalary; //1.直接添加 vecSalary.push_back(2000); vecSalary.push_back(3000); //2.按位置添加 vecSalary.insert(vecSalary.begin(), 1000);原创 2013-05-17 18:00:43 · 2600 阅读 · 0 评论 -
【C++】容器元素的复制和变换
一、复制容器元素:copy()算法copy()的原形如下: template OutputIterator copy( InputIterator _First, //源容器起始位置 InputIterator _Last, //源容器终止位置 OutputIterator _DestBeg //目标容器的起始位置 );列子:将两张成绩表统计到一起,形成一张成绩总表原创 2013-05-17 17:49:09 · 4129 阅读 · 0 评论 -
【C++】读写文件
#include #include using namespace std;int main(){ // 读文件, 保存至fileContent中 string openFile = "C:\\1.txt"; ifstream inf; inf.open(openFile.c_str(), ios::in); string lineConten原创 2012-12-18 14:55:11 · 522 阅读 · 0 评论 -
【C++】stringToInt intToString
#include #include using namespace std;int main(){ // intToString stringstream ss; int num = 123456; ss << num; string s = ss.str(); if (!ss.good()) { //error }转载 2012-12-18 15:27:35 · 3200 阅读 · 0 评论 -
【C++】函数传参
1.指针参数#include "stdafx.h"#include using namespace std;char * a = new char[20];void test(char * pArr){ cout<<&pArr<<endl; a = "hello"; pArr = a; cout<<pArr<<endl;}原创 2013-01-30 16:14:06 · 493 阅读 · 0 评论