#define strmax 100
#include
#include
class string
{
char line[100];
int x,y;
public:
string(char *);
void print();
void turn();
int strlength();
void substring(unsigned,unsigned);
void insert(int,char *);
void index(char *);
void replace(char *,char *);
void strempty();
string operator (string s);
string operator + (string s);
void operator < (string s1);//判断字符窜长度
void operator (string s1);//字符窜相等
void operator ! (string s1);//字符窜不相等
char operator [] (int pos);
};
string::string(char *n)
{
strcpy(line,n);
}
void string::print()
{
cout<< line;
}
void string::turn()
{
int i,lenstrlen(line);
for(i0;i
{
if(line[i]>97&&line[i]<122)
{
line[i]-32;
cout<< line[i];
}
else
{
cout<< line[i];
}
}
}
int string::strlength()
{
return strlen(line);
}
void string::substring(unsigned pos,unsigned len)
{
if(pos > strlen(line))
cout<<"Error!";
else
{
if((strlen(line)-pos) < len)
lenstrlen(line)-pos;
cout<<"The substring is:";
unsigned ipos+len;
for(pos;pos
{
cout<< line[pos-1];
}
}
}
void string::insert(int pos,char *p)
{
char p1[64];
char p2[64];
strcpy(p1,p);
cout<<"The line which will be insert is:"<
int lstrlen (p1);
int m0;
int c0;
for(int bpos-1;b<64;b++,c++)
{
p2[c]line[b];
}
for(int apos-1;a
{