希望减少每次数据库的范围可以考虑用缓存。。缓存分永久缓存、时间缓存、和依赖缓存。。1.永久缓存if (Cache["cache"]!=null) { }else { ...
分类:
Web程序 时间:
2015-04-07 19:00:52
阅读次数:
122
测试闰年的算法:算法1:int year;cin >> year;if(year % 4 != 0) cout > year;if(year % 4 == 0 && year % 100 != 0) cout << "是闰年";else if(year % 400 == 0) cout << ...
分类:
编程语言 时间:
2015-04-07 17:21:08
阅读次数:
159
哈夫曼树哈夫曼树也叫最优二叉树(哈夫曼树)问题:什么是哈夫曼树?例:将学生的百分制成绩转换为五分制成绩:≥90 分: A,80~89分: B,70~79分: C,60~69分: D,<60分: E。 if (a < 60){ b = 'E'; } else if (a...
分类:
其他好文 时间:
2015-04-07 17:11:02
阅读次数:
230
首先判断
如果是小写:
if(islower(str[i]))
把小写字母变成大写字母,函数就是toupper
str[i] = toupper(str[i]);
else
如果是大写字母。变成小写字母函数是:tolower
str[i] = tolower(str[i]);
检测大写字母是:isupper
检测小写字母是:islower
大写------->小写:to...
分类:
编程语言 时间:
2015-04-06 21:55:14
阅读次数:
242
#include
#include
#include
#define MAXN 21
using namespace std;
char str[MAXN];
int main()
{
cin>>str;
for(int i = 0; i
{
if(islower(str[i]))
str[i] = toupper(str[i]);
else if(isupper...
分类:
其他好文 时间:
2015-04-06 21:53:56
阅读次数:
133
封装ajaxget请求,适用于异步获取js文件functionajaxGetJs(url,callback){
varxmlhttp;
if(window.XMLHttpRequest){
xmlhttp=newXMLHttpRequest();
}else{
xmlhttp=newActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send();
setInterval(fun,..
分类:
Web程序 时间:
2015-04-06 18:57:49
阅读次数:
152
// 验证计算机是大端存储还是小端存储
#include
int main()
{
int a = 1;
char *p;
p = (char *)(&a);
if(*p == 0 )
printf("当前计算机是大端存储\n");
else
printf("当前计算机是小端存储\n");
return 0;
}
//也可以用联合实现
#include
uni...
分类:
编程语言 时间:
2015-04-06 15:42:42
阅读次数:
162
//编写一个函数实现n^k,使用递归实现
#include
int fun(int n,int k) //求n的k次方
{
int sum;
if (k==0)
{
sum=1;
}
else
{
sum=n*fun(n,k-1);
}
return sum;
}
int main ()
{
printf("%d\n",fun(2,3));
return 0...
分类:
编程语言 时间:
2015-04-06 14:17:11
阅读次数:
109
defprocess_item(self,item,spider):ifre.search(r‘***‘,item[‘lineContent‘].encode(‘utf8‘)):raiseDropItem("noneedin%s"%item[‘lineContent‘])else:ifspider.name==‘**‘:query=self.dbpool.runInteraction(self._conditional_insert,item)#query.addErrback(self.handle_err..
分类:
其他好文 时间:
2015-04-06 06:35:15
阅读次数:
1264
//编写一个函数实现n^k,使用递归实现
#include
int cifang( int x, int y )//2^3=2*2*2
{
int sum = 0;
if( y == 0 )
sum = 1;
else
sum = x * cifang( x, ( y - 1 ) );
return sum;
}
int main()
{
printf("%d\n",ci...
分类:
编程语言 时间:
2015-04-05 20:34:38
阅读次数:
149