
#include <string>

using namespace std;
char *deletechar(char*inputstr,char *outputstr)
{
char *deststr=outputstr;
bool table[26]={false};
int k=0;
for (int i=0;i<strlen(inputstr);i++)
{
char c=inputstr[i];
if (table[c-'a']==false)
{
outputstr[k++]=c;
table[c-'a']=true;
}
}
outputstr[k]='';
return deststr;
}
void main()
{
char str1[]="aaaabdcadjoiufdjouj";
char *deststr=new char[strlen(str1)+1];
memset(deststr,0,strlen(str1)+1);
cout<<deletechar(str1,deststr);
}
分享題目:去掉字符串中重復(fù)的字符-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://www.yijiale78.com/article0/djgsoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、App設(shè)計、手機(jī)網(wǎng)站建設(shè)、營銷型網(wǎng)站建設(shè)、網(wǎng)站改版、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容