如何c语言编程实现从字符串“aaaaaabcbcbcc”中删除字符串“abc”,输出效果:"aa

c",求解答!... c",求解答! 展开
 我来答
xd_zs
2014-12-03 · 超过15用户采纳过TA的回答
知道答主
回答量:36
采纳率:0%
帮助的人:25.2万
展开全部
#include "stdio.h"
#include "conio.h"

main()
{
char* inputStr;
char* chPosi;
scanf("%s", inputStr);
chPosi = strstr(inputStr, "abc");
while(chPosi!=NULL)
{
while(*chPosi!=NULL)
{
*chPosi = *(chPosi+3);
chPosi++;
}
chPosi = strstr(inputStr, "abc");
}

printf("%s\n", inputStr);
getch();
}
追问
好像编译不了。我用的是虚拟机。没有conio.h
追答
直接将#include "conio.h"删除吧
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式