欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
C++語言刪除指定位置m后n個字符程序
[打印本頁]
作者:
daming
時間:
2014-12-30 02:05
標題:
C++語言刪除指定位置m后n個字符程序
本帖最后由 daming 于 2014-12-30 02:16 編輯
#include<iostream.h>
class str
{
private:
char *p;
int m,n;
public:
str(char a[])
{
p=a;
cin>>m>>n;
}
int strdel()
{
int i=0,j=0;
while(p[i++]);
i--;
if(m+n>i)
return 0;
else{
i=m;
j=m+n;
while(p[j])
p[i++]=p[j++];
p[i]=0;
return 1;
}
}
void print()
{
if(strdel()==1) //調用了 strdel 一次
cout<<"1"<<endl
<<p<<endl;
else
cout<<"0"<<endl;
}
};
void main()
{
char a[10];
cin>>a;
str A(a);
A.print();
}
復制代碼
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1