std::swap()是个很有用的函数,它可以用来交换两个变量的值,包括用户自定义的类型,只要类型支持copying操作,尤其是在STL中使用的很多,例如:int
main(int argc, _TCHAR* argv[]) { int a[10] = {1,2,3,4,5,6,7,8,...
分类:
编程语言 时间:
2014-05-19 15:22:41
阅读次数:
378
#includeusing namespace std;//大根堆,从小到达排序int
a[101];void swap(int &a,int &b){ a=a^b; b=a^b; a=a^b; }void adjust(int
*a,int root,int len){ int max=root;...
分类:
其他好文 时间:
2014-05-19 15:13:43
阅读次数:
219
我也不知道为什么作者给这个条款起这样的名字,因为这样看上去重点是在“不抛出异常”,但事实上作者只是在全文最后一段说了一下不抛异常的原因,大部分段落是在介绍怎样写一个节省资源的swap函数。你可以试一下,只要包含了头文件iostream,就可以使用swap函数,比如:1
#include 2 3 in...
分类:
编程语言 时间:
2014-05-19 13:44:31
阅读次数:
423
FileChannel是flume一个非常重要的channel组件,非常常用。这个channel非常复杂,涉及的文件更多涉及三个包:org.apache.flume.channel.file、org.apache.flume.channel.file.encryption(加密)、org.apa.....
分类:
其他好文 时间:
2014-05-19 13:02:06
阅读次数:
285
在java.io包中得操作主要有字节流与字符流两大类,两个类都有输入输出操作。
在字节流中,输出数据主要使用OutputStream类,输入使用的InputStream类。
在字符流中,输出数据使用Writer,输入数据使用Reader。
在Java中IO操作有相应的步骤,以文件的操作为例。
(1)使用File类打开一个文件
(2)通过字节流或字符流的子类指定输出的位置。
(3)进行读...
分类:
编程语言 时间:
2014-05-18 18:33:04
阅读次数:
270
#include
using namespace std;
//定义一个函数,用于交换两个变量的值
void swap(int &a, int &b);
void main()
{
int i = 3, j = 5;
cout<<"交换前:i="<<i<<" j="<<j<<endl;
swap(i,j);
cout<<"交换后:i="<<i<<" j="<<j<<endl;...
分类:
其他好文 时间:
2014-05-18 16:05:54
阅读次数:
209
【题目】
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. You may not modify the values in the list, only nodes it...
分类:
其他好文 时间:
2014-05-18 08:37:57
阅读次数:
370
文件对象内建方法列表
文件对象的方法
操作
file.close()
关闭文件
file.fileno()
返回文件的描述符(file descriptor,FD,整数值)
file.flush()
刷新文件的内部缓冲区
file.isatty()
判断fil...
分类:
编程语言 时间:
2014-05-18 06:23:28
阅读次数:
197
package com.jielan.servlet;
import java.io.File;
import java.util.ArrayList;
import jxl.Sheet;
import jxl.Workbook;
import com.jielan.util.DBUtil;
import com.jielan.util.Oracle;
public class Test {...
分类:
数据库 时间:
2014-05-18 04:55:19
阅读次数:
368
IPC进程间通信+共享内存Mapping
IPC(Inter-Process Communication,进程间通信)。
文件映射(Mapping)是一种将文件内容映射到内存地址的技术,通过对映射内存,读写文件如同读写内存一般简单。
多个进程映射同一个文件映射对象,也即多个进程映射到同一个物理存储页面,因此,当一个进程...
分类:
移动开发 时间:
2014-05-18 04:28:39
阅读次数:
324