/*字符串匹配*/
#include
using namespace std;
void get_next(string T,int *next)
{//朴素算法
int i,j;
i=1;
j=0;
next[1]=0;
while(i<T.length())
{
if(j==0 || T[i]==T[j])
{
i++;
j++;
next[i]=j;
...
分类:
编程语言 时间:
2015-07-01 18:22:16
阅读次数:
140
代码: 1 #include 2 #include 3 4 using namespace std; 5 6 struct ListNode { 7 int val; 8 ListNode *next; 9 ListNode(int x) : val(x), ne...
分类:
其他好文 时间:
2015-07-01 18:00:08
阅读次数:
84
一个进程连接数据流到另一个进程--管道--pipe进程管道1 #include 2 FILE * popen(const char * command, const char * open_mode)3 int pclose(FILE * stream_to_close);popen函数允许一个程序...
分类:
系统相关 时间:
2015-07-01 17:53:18
阅读次数:
248
今天帮师姐调一个程序的BUG,师姐的程序中有个结构体直接赋值的语句,在我印象中结构体好像是不能直接赋值的,正如数组不能直接赋值那样,我怀疑这个地方有问题,但最后证明并不是这个问题。那么就总结一下C语言中结构体赋值的问题吧:结构体直接赋值的实现下面是一个实例:#include struct Foo {...
分类:
编程语言 时间:
2015-07-01 17:35:28
阅读次数:
152
1. Posix 消息队列/* mq_open - open a message queue */#include /* For O_* constants */#include /* For mode constants */#include mqd_t mq...
分类:
系统相关 时间:
2015-07-01 17:31:34
阅读次数:
167
代码: 1 #include 2 #include 3 4 using namespace std; 5 6 vector spiralOrder(vector>& matrix) 7 { 8 if (matrix.size() == 0) 9 return vector...
分类:
其他好文 时间:
2015-07-01 17:23:19
阅读次数:
135
输入若干非负整数数字,请先取出奇数数字按从大到小排序,再取出偶数数字,从小到大排序。样例输入:12 34 5 7 92 3 8样例输出: 7 5 3 8 12 34 92不同语言的解法1,使用C语言来解决#include #include #include // little -> bigint c...
分类:
编程语言 时间:
2015-07-01 17:18:57
阅读次数:
137
这里主要是以 C 语言为例,其他语言开发的程序,每个进程都会有一个类似的空间。下面是一段 C 代码:#include #include double t[0x02000000];void segments(){ static int s = 42; void *p = mal...
分类:
系统相关 时间:
2015-07-01 17:17:42
阅读次数:
174
主要是栈的应用,里面有两个函数deleteSpace(),stringToDouble()在我另一篇博客当中:对string的一些扩展函数。
本程序只是基本的功能实现,没有差错控制。
#include
#include
#include
#include
#include"fstring.h"
/*
*采用逆波兰表示法求解数学表达示
*1、将输入的中缀表示示转换成后...
分类:
编程语言 时间:
2015-07-01 16:07:42
阅读次数:
146
#include
using namespace std;
//实现一个函数求字符串的长度。
int my_length(const char *s)
{
if (*s == '\0')return 0;
else
return 1+my_length(s + 1);
}
int main()
{
char *s = "123456";...
分类:
编程语言 时间:
2015-07-01 16:05:21
阅读次数:
211