#includeusing namespace std;//13457689* 23int foun(char c[],int m){ int len=strlen(c); char s; bool flag; int x=0,d[1000]; for(int i=0...
分类:
其他好文 时间:
2015-04-09 19:28:31
阅读次数:
243
#include
#include
using namespace std;
class string1
{
private:
char *str;
public:
string1(const char *s)
{
str = new char[strlen(s) + 1];
strcpy(str,s);
cout<<"str...
分类:
编程语言 时间:
2015-04-09 17:23:38
阅读次数:
132
#include
#include
using namespace std;
class A
{
private:
char *a;
public:
A(char *aa)
{
a = new char[strlen(aa)+1]; //(a)这样处理的意义在于:为aa指针开辟出空间
strcpy(a, aa); /...
分类:
其他好文 时间:
2015-04-09 15:30:44
阅读次数:
109
求次数
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
题意很简单,给一个数n 以及一个字符串str,区间【i,i+n-1】 为一个新的字符串,i 属于【0,strlen(str)】如果新的字符串出现过ans++,例如:acmacm n=3,那么 子串为acm cma mac acm ,只有acm出现过
求ans;
输入...
分类:
其他好文 时间:
2015-04-09 09:01:37
阅读次数:
83
三大字符处理函数实现||||
==--==--==--==--==--==--
strlen , strcpy, strcmp....
分类:
其他好文 时间:
2015-04-08 18:01:47
阅读次数:
110
#include#include#includeint main(){int i;char a[110]; while(gets(a)) { printf("%c",a[0]-32); for(i=1;i<strlen(a);i++) { if(a[i-1]==' ') { a[i]=a[i]-32...
分类:
其他好文 时间:
2015-04-08 14:53:09
阅读次数:
113
MD5加密字符串并转化为base64(C#和PHP代码相同实现)-------PHP------代码-------------function Md5Base64($data){ $md5hex=md5($data); $len=strlen($md5hex)/2; $md5raw=""; for(...
求次数
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
题意很简单,给一个数n 以及一个字符串str,区间【i,i+n-1】 为一个新的字符串,i 属于【0,strlen(str)】如果新的字符串出现过ans++,例如:acmacm n=3,那么 子串为acm cma mac acm ,只有acm出现过
求ans;
输入...
分类:
其他好文 时间:
2015-04-08 09:19:13
阅读次数:
124
编写一个函数reverse_string(char * string)(递归实现)
实现:将参数字符串中的字符反向排列。
#include
#include
#include
int reverse_string(char * str)
{
assert(str);
int len=strlen(str);
char *ch=str+len-1;
whi...
分类:
编程语言 时间:
2015-04-07 13:53:58
阅读次数:
171
sizeof是计算数据类型占用内存的大小。当计算字符串占存大小时。
sizeof(string)=strlen(string)+1;
原因很简单,string数组在存储时会补上最末位的‘\0’结束符。
举个例子:
#include
#include
int main()
{
char p[]="Tencent";
printf("%d\n",sizeof(p));
...
分类:
其他好文 时间:
2015-04-07 10:03:27
阅读次数:
149