摘要:
#include<iostream>#include<stdio.h>#include<string.h>using namespace std;int main(){ char s[50]={'\0'}; char str[30]="1233422222"; int len = strlen(str); for( int i = 0; i < len; ++i ) { int count = 1; while( str[i] == str[ i + 1 ] ) { i++; count++; } spr... 阅读全文
posted @ 2013-04-08 13:55
NinaGood
阅读(254)
评论(0)
推荐(0)
摘要:
#include<iostream>#include<stdio.h>#include<string.h>using namespace std;void reverse( char * str ,int i,int j){ char tmp; while( i < j ) { tmp = str[i]; str[i] = str[j]; str[j] = tmp; i++; j--; }}int main(){ char str[]="i come from tianjin."; int len = strlen(str); in 阅读全文
posted @ 2013-04-08 10:58
NinaGood
阅读(156)
评论(0)
推荐(0)
摘要:
//注意:检测函数值返回值是否NULL,当返回值为NULL时不能输出。#include<iostream>using namespace std;char * mystrstr( char * str, char * sub){ for( int i = 0; str[i] != '\0'; ++i ) { int j = 0; int tmp = i; if( str[i] == sub[j] ) { while( str[i++] == sub[j++] ) { if( sub[j] == '\0' ) { re... 阅读全文
posted @ 2013-04-08 09:44
NinaGood
阅读(315)
评论(0)
推荐(0)

浙公网安备 33010602011771号