
為啥子會出現亂碼?????
該怎么改????
#include<stdio.h>
#include<string.h>
int main()
{
char str[41]={1},con[5]={1};
int a,b,c,x,flag=0;
gets(str);
gets(con);
//洗掉
if(con[0]=='D')
{
for(a=0;str[a]!='\n';a++)
{
if(str[a]==con[2])
{
for(x=0;x<a;x++)
printf("%c",str[x]);
for(x=(a+1);str[x]!='\n';x++)
printf("%c",str[x]);
break;
}
if(str[a]=='.')
{
puts("Not exist");
break;
}
}
}
//插入
if(con[0]=='I')
{
for(a=40;a>=0;a--)
{
if(str[a]==con[2])
{
for(x=0;x<a;x++)
printf("%c",str[x]);
printf("%c",con[4]);
for(x=a;str[x]!='\n';x++)
printf("%c",str[x]);
break;
}
if(str[a]==str[0])
{
puts("Not exist");
break;
}
}
}
//替換
if(con[0]=='R')
{
for(a=0;str[a]!='\n';a++)
{
if(str[a]==con[2])
{
str[a]=con[4];
flag=1;
}
if(str[a]=='.')
{ if(flag==1)
{
for(x=0;str[x]!='\n';x++)
{printf("%c",str[x]);}break;
}
else
{
puts("Not exist");
break;
}
}
}
}
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/193138.html
標籤:新手樂園
上一篇:有沒有大神會yuv視頻播放
下一篇:楊輝三角佇列
