
c++基础
chuanyu
个人开发者
展开
-
c++之map 基本用法
1. map最基本的构造函数; map<string , int >mapstring; map<int ,string >mapint; map<sring, char>mapstring; map< char ,string>mapchar; map<char ,int>mapchar; map<转载 2015-05-21 09:50:41 · 2631 阅读 · 0 评论 -
C++通过域名获取IP地址的方法;调试通过!
// project.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <math.h>#include <stdio.h>#include <string.h>//#include <afx.h>//#include <Winsock.h>#include <w...原创 2019-05-26 20:15:57 · 1407 阅读 · 0 评论 -
c++模板
#include<iostream>using namespace std;int add(int a,int b){ return a+b;}double add(double a,double b){ return a+b;}char add(char a,char b){ return a+b;} int main(){ cout<<...转载 2019-05-25 16:45:18 · 139 阅读 · 0 评论 -
c++中运算符的重载
程序1.cpp#include<iostream.h>int main(){ int a=3,b=2; cout<<a+b<<endl; return 0;}上面的程序中定义了两个整形变量a和b。并输出两个整形变量之和程序2.cpp#include<iostream>using namespace std; c...转载 2019-05-25 16:38:36 · 964 阅读 · 0 评论 -
c++虚函数的学习
1.虚函数#include<iostream.h> class Base{public: void print() { cout<<"Base"<<endl; }}; class Son:public Base{public: void print() { cout<<"Son"<<endl; ...转载 2019-05-25 16:31:18 · 192 阅读 · 0 评论 -
计算机科学中最重要的32个算法
原文地址http://www.infoq.com/cn/news/2012/08/32-most-important-algorithms奥地利符号计算研究所(Research Institute for Symbolic Computation,简称RISC)的Christoph Koutschan博士在自己的页面上发布了一篇文章,提到他做了一个调查,参与者大多数是计算机科学家,他请这...转载 2019-05-25 16:09:20 · 272 阅读 · 0 评论 -
MFC下读取 ini文件的数值 (GetCurrentDirectory, GetPrivateProfileInt )
1.文件名:Server.ini2.文件内容[RoomSet]//游戏人数设置PlayerCount=2//客户端底分显示ShowBaseScore=03.读取配置文件信息TCHAR szPath[MAX_PATH] = TEXT("");GetCurrentDirectory(sizeof(szPath), szPath);TCHAR szFi原创 2016-11-02 16:31:23 · 1028 阅读 · 0 评论 -
对一个数组的数进行 去重
int n = 11;int a[] = { 1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5 };n = unique(a, a + n) - a;//使用STL自带去重函数,返回值为最后一个元素的位置(地址)for (int i = 0; i cout }原创 2016-11-11 18:44:54 · 2984 阅读 · 0 评论 -
memcpy的用法总结
转:http://blog.youkuaiyun.com/lovemysea/article/details/5275612#reply1、memcpy 函数用于 把资源内存(src所指向的内存区域) 拷贝到目标内存(dest所指向的内存区域);拷贝多少个?有一个size变量控制拷贝的字节数;函数原型:void *memcpy(void *dest, void *src, unsi转载 2016-06-15 12:39:25 · 533 阅读 · 0 评论 -
jsoncpp解析 json对象
void GetHttpValue::urlopen(std::string url){std::string stTemp;char chTemp[1000];ZeroMemory(chTemp, 1000);HINTERNET hSession = InternetOpen(_T("UrlTest"), INTERNET_OPEN_TYPE_PRECONFIG, NULL,原创 2015-12-17 10:43:54 · 2094 阅读 · 0 评论 -
c++获取http返回的json数据
//头文件#include "stdafx.h"#include #include #include #include #include #define MAXSIZE 1024#pragma comment(lib, "Wininet.lib") using namespace std;#pragma warning(disable原创 2015-12-16 18:01:59 · 6996 阅读 · 1 评论 -
各种类型转换 C++
1.int转stringchar buffer[50];int count = value["total"].asInt();sprintf_s(buffer, "%d", count);std::string out = buffer;2. string转intstd::string str = "123";int n = atoi(str.c_str(原创 2015-05-25 16:53:35 · 550 阅读 · 0 评论 -
c++ 用指针使用函数中new的内存块,用完释放
调用函数pVoidData接收函数中返回的指针,用完后delete[] 定义的Data2WebData函数,new一块内存区域,利用 定义的void*函数返回值返回原创 2015-09-02 10:31:54 · 2176 阅读 · 0 评论 -
代码有趣注释图案
/* _.-"""""-._ _.-"""""-._ _.-"""""-._ ,' `. ,' `. ,' `. / \ / \ / ...原创 2019-06-14 17:40:52 · 4656 阅读 · 0 评论