![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 54
Dramatically
心比天高,命比纸薄
展开
-
《C++ STL编程轻松入门》
点击打开链接转载 2015-04-07 15:17:52 · 522 阅读 · 0 评论 -
const void *a 与 void* const a
const void *a定义了一个指针a,a可以指向任意类型的值,但它指向的值必须是常量。在这种情况下,我们不能修改被指向的对象,但可以使指针指向其他对象。例如:const void *a;*a=0x123;//是编译通不过的,因为*a中放的是个const值。const值是不能被改变的。const int m=1;const int n=2;a=&m;a=&n;/转载 2015-04-14 15:47:58 · 869 阅读 · 0 评论 -
timeval
timeval结构的用于指定时间值。//头文件 //结构timeval{ time_t tv_sec; //秒 [long int] suseconds_t tv_usec; //微秒 [long int]};原创 2015-04-14 15:45:37 · 4493 阅读 · 0 评论 -
JOBDU Q1003
题目:A+B/*题目描述:给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号","隔开。现在请计算A+B的结果,并以正常形式输出。输入:输入包含多组数据数据,每组数据占一行,由两个整数A和B组成(-10^9 < A,B < 10^9)。输出:请计算A+B的结果,并以正常形式输出,每组数据占一行。样例输入:-234,567,890 123,456,7891,234原创 2015-04-08 09:34:11 · 583 阅读 · 0 评论 -
gcc命令
一般用法:(1)编译.c文件:gcc -o example example.c(2)编译.cpp文件: gcc -o example example.cpp -lstdc++或者: g++ -o example example.cpp或者: c++ -g -o example example.cpp 详细说明:在使用GCC编译器的时候,我们必原创 2015-04-07 15:41:50 · 573 阅读 · 0 评论 -
socket 常用函数
创建int socket(int domain, int type, int protocol);参数说明:domain:协议域,又称协议族(family)。常用的协议族有AF_INET、AF_INET6、AF_LOCAL(或称AF_UNIX,Unix域Socket)、AF_ROUTE等。协议族决定了socket的地址类型,在通信中必须采用对应的地址,如AF_INET决定了要用ip原创 2015-04-14 15:59:07 · 778 阅读 · 0 评论 -
select 与 fd_set
select(),确定一个或多个套接口的状态,本函数用于确定一个或多个套接口的状态,对每一个套接口,调用者可查询它的可读性、可写性及错误状态信息,用fd_set结构来表示一组等待检查的套接口,在调用返回时,这个结构存有满足一定条件的套接口组的子集,并且select()返回满足条件的套接口的数目。用途:确定一个或多个套接口的状态,如需要则等待。#include int PASC原创 2015-04-14 15:17:35 · 1648 阅读 · 0 评论 -
JOBDU Q1004
题目:有序数列合并,输出中位数/*题目描述:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9,原创 2015-04-08 09:35:05 · 730 阅读 · 0 评论 -
JOBDU Q1002
题目:按规则打分。/*题目描述:Grading hundreds of thousands of Graduate Entrance Exams is a hard work. It is even harder to design a process to make the results as fair as possible. One way is to assign each ex原创 2015-04-08 09:28:14 · 1050 阅读 · 0 评论 -
JOBDU Q1001
题目:数组求和,输出全为0的行列数。/*题目描述:This time, you are supposed to find A+B where A and B are two matrices, and then count the number of zero rows and columns.输入:The input consists of several test cases, e原创 2015-04-08 09:12:52 · 670 阅读 · 0 评论 -
Set集合常用操作
1) 元素插入:insert()2) 中序遍历:类似vector遍历(用迭代器)3) 反向遍历:利用反向迭代器reverse_iterator。set s;......set::reverse_iterator rit;for(rit=s.rbegin();rit!=s.rend();rit++)4) 元素删除:与插入一样,可以高效的删除,并自原创 2015-04-07 15:07:59 · 830 阅读 · 0 评论 -
Interator 迭代器
std::map::iterator iter = ss_map.begin();迭代器模式由以下角色组成:1) 迭代器角色(Iterator):迭代器角色负责定义访问和遍历元素的接口。2) 具体迭代器角色(Concrete Iterator):具体迭代器角色要实现迭代器接口,并要记录遍历中的当前位置。3) 容器角色(Container):容器角色负责提供创建具体迭代器角色原创 2015-04-07 14:35:15 · 670 阅读 · 0 评论 -
std::map
映射和多重映射基于某一类型Key的键集的存在,提供对T类型的数据进行快速和高效的检索。对map而言,键只是指存储在容器中的某一成员。Map不支持副本键,multimap支持副本键。Map和multimap对象包涵了键和各个键有关的值,键和值的数据类型是不相同的,这与set不同。set中的key和value是Key类型的,而map中的key和value是一个pair结构中的两个分量。原创 2015-04-07 14:50:29 · 1000 阅读 · 0 评论