#include#includeusing namespace std;/*用最小表示法求字符串S的最小字典序返回字典序最小的串的首字母位置*/int minstr(char s[]){ int len=strlen(s); int i=0,j=1; while(i=len) ...
分类:
其他好文 时间:
2014-10-09 15:09:54
阅读次数:
126
数组元素的结束符为'\0',串的结束符为NULL
一、strlen
#include
using namespace std;
long h_strlen(constchar*str){
assert(str!=NULL);
const char *s = str;
while (*s++);
return (s - str - 1);
}...
分类:
其他好文 时间:
2014-10-09 02:55:07
阅读次数:
190
统计每一位出现1的个数 求组合数直接贴代码#include #include #include #include #include #include #include #define CL(a,b) memset(a,b,sizeof(a))#define INF 0x3fffffff#define...
分类:
其他好文 时间:
2014-10-09 02:28:17
阅读次数:
179
http://poj.org/problem?id=2506#include #include #include #include using namespace std;int a[260][260];int main(){ int n,i,j; memset(a,0,sizeof(a...
分类:
其他好文 时间:
2014-10-09 01:53:57
阅读次数:
183
#include #include #include void binary_num(int, int);int main( int argc, char* argv[] ) { int a = 30; binary_num(a, sizeof(a) * 8); print...
分类:
其他好文 时间:
2014-10-09 01:27:27
阅读次数:
204
1 $str1="是你"; 2 $strA = trim($str1); 3 $lenA = strlen($strA); 4 $lenB = mb_strlen($strA,"utf-8"); 5 ...
分类:
Web程序 时间:
2014-10-08 16:23:35
阅读次数:
241
#includeusing namespace std;int BFMatch(char* s,char* p){ int i=0; int j=0; while(i<strlen(s)) { while(s[i]==p[j]&&j<strlen...
分类:
其他好文 时间:
2014-10-07 23:09:44
阅读次数:
189
程序设计的三种典范(c++对象模型)1.程序模型就像c中那也的str*系列的函数如:char boy[] = "wcfsf";char p = new char[strlen(boy) + 1];strcpy(p, boy);感觉这个就是在函数内部实现的,没有什么封装的概念2.抽象数据类型(ADT)...
分类:
其他好文 时间:
2014-10-07 18:55:53
阅读次数:
174
C/C++变量在内存中的分布在笔试时经常考到,虽然简单,但也容易忘记,因此在这作个总结,以加深印象。
一:
#include
#include
int g_i = 100;
int g_j = 200;
int g_k, g_h;
int main()
{
const int MAXN = 100;
int *p = (int*)malloc(MAXN * sizeof(int));...
分类:
编程语言 时间:
2014-10-06 19:45:20
阅读次数:
321