定义string数组:C++ string类使用、定义疯狂代码  CrazyCoder/        ĵ:http:/CrazyCoder/VC/Article31017.html
# strmax 100
# <iostream.h>
# <c>
{
char line[100];
x,y;
public:
(char *);
void pr;
void turn;
strlength;
void sub(unsigned,unsigned);
void insert(,char *);
void index(char *);
void replace(char *,char *);
void strempty;
operator = ( s);
operator + ( s);
void operator <= ( s1);//判断窜长度  void operator  ( s1);//窜相等
void operator != ( s1);//窜不相等  char operator  ( pos);
};
/
/=
::(char *n)
{
strcpy(line,n);
}
//=
void ::pr
{
cout<< line;
}
//=
void ::turn
{
i,len=strlen(line);
for(i=0;i<len;i)
{
(line[i]>=97&&line[i]<=122)  {
line[i]-=32;
cout<< line[i];
}
{
cout<< line[i];
}
}
}
//=
::strlength
{
strlen(line);
}
//=
void ::sub(unsigned pos,unsigned len)
{
(pos > strlen(line))
cout<<"Error!";
{
((strlen(line)-pos) < len)
len=strlen(line)-pos;
cout<<"The sub is:";
unsigned i=pos+len;
for(pos;pos<i;pos)
{
cout<< line[pos-1];
}
}
}
//=
void ::insert( pos,char *p)
{
char p1[64];
char p2[64];
strcpy(p1,p);
cout<<"The line which will be insert is:"<<p1;  l=strlen (p1);
m=0;
c=0;
for( b=pos-1;b<64;b,c)
c++中字符串数组怎么定义{
p2[c]=line[b];
}
for( a=pos-1;a<pos+l;a,m)
{
line[a]=p1[m];

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。