#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>

using namespace std;


void del(char *str,char c)
{
    char *head = NULL;
    char *p = NULL;
    head = p = str;

    while(*p != '\0')
    {
        if(*p != c)
        {
            *str = *p;
            str++;
        }
        p++;
    }
    *str = '\0';
}

int main()
{
    cout<<"输入一个字符串:"<<endl;
    char value[256];
    cin>>value;
    cout<<"输入要删除的字符"<<endl;
    char c;
    cin>>c;
    del(value,c);
    cout<<"删除后的结果为:"<<value<<endl;
    return 0;
}

 

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2021-10-27
相关资源
相似解决方案