ereg()字符串比对解析。语法:int ereg(string pattern, string string, array [regs]);返回值:整数/数组函数种类:资料处理内容说明本函数以 pattern 的规则来解析比对字符串 string。比对结果返回的值放在数组参数 regs 之中,re...
分类:
Web程序 时间:
2015-07-11 11:56:05
阅读次数:
151
POJ2533裸的LIS,时间复杂度为O(n^2) 1 #include 2 #include 3 using namespace std; 4 const int MAXN=1000+5; 5 int a[MAXN]; 6 int dp[MAXN]; 7 int n,ans; 8 9 int m....
分类:
其他好文 时间:
2015-07-11 11:46:32
阅读次数:
93
随机生成字母, 判断是元音字母还是辅音字母.代码://: Main.javaimport java.util.Random;/**
* 判断元音辅音
*/
class Main {
public static void main(String[] args) {
Random rand = new Random(47);
for (int i=0; i<...
分类:
编程语言 时间:
2015-07-11 10:42:33
阅读次数:
186
隐式转换
定义:
以implicit关键字声明的带有单个参数的函数。
implicit def int2Fraction(n: Int) = Fraction(n, 1)val result = 3 * Fraction(4, 5) //调用int2Fraction(3)
//隐式转换将整数3转换成了一个Fraction对象。这个对象又被乘以Fraction(4, 5)利用隐式转换丰富现有...
分类:
其他好文 时间:
2015-07-11 10:41:37
阅读次数:
181
#include
using namespace std;
int main(int argc, char *argv[]){
double sum=0;
float monthConsume;
for(int i=0;i>monthConsume;
sum+=monthConsume;
}
cout<<"$"<<sum/12<<endl;
...
分类:
其他好文 时间:
2015-07-11 10:39:58
阅读次数:
103
#include #include #include #include #include #include const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; SDL_Window* gWindow = NULL; SDL_Ren...
分类:
其他好文 时间:
2015-07-11 10:34:13
阅读次数:
107
链接:点我输入顺序又反了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #define MOD 100000000710 const int ...
分类:
其他好文 时间:
2015-07-11 10:28:05
阅读次数:
82
flex程序默认总是从标准输入读取, 实际上,词法分析程序都从文件读取输入flex总是通过名为yyin的文件句柄读取输入, 下面的例子,我们修改单词计数程序,使得它能从文件读取输入/* even more like Unix wc */%option noyywrap%{int chars = 0;...
分类:
其他好文 时间:
2015-07-11 10:22:57
阅读次数:
130
13.4 pipe调用
在看过高级的popen函数之后,再来看看底层的pipe函数.通过这个函数在两个程序之间传递数据不需要启动一个shell来解释请求的命令.它同时提供了对读写数据的更多控制.
pipe函数的原型如下所示:
#include
int pipe(int file_descriptor[2]);参数:是一个由两个整数类型的文件描述符组成的数组.
返回值:该函数在数组中...
分类:
系统相关 时间:
2015-07-11 09:20:14
阅读次数:
287
void FindNumsAppearOnce(int data[], int length, int* num1, int* num2)
{
if (data == NULL || length
return;
int resultExclusiveOR = 0;
for (int i = 0; i
resultExclusiveOR ^= data[i];
unsigned ...
分类:
编程语言 时间:
2015-07-11 09:18:58
阅读次数:
251