zoukankan      html  css  js  c++  java
  • [YTU]_1998( C语言实验——删除指定字符)

    Description

    从键盘输入一个字符串给str和一个字符给c,删除str中的所有字符c并输出删除后的字符串str。

    Input

    第一行是一个字符串; 第二行是一个字符。

    Output

    删除指定字符后的字符串。

    Sample Input

    sdf$$$sdf$$
    $
    
    
    

    Sample Output

    sdfsdf
    #include <iostream>
    #include <cstring>
    using namespace std;
    int main()
    {
        char str[101],c,array[101];
        int i,n=0,m;
         gets(str);
        cin>>c;
        for(i=0;i<strlen(str);i++)
        {
            if(str[i]!=c)
            {
                array[n]=str[i];
                n++;
            }
        }
            array[n]='';
         
                cout<<array;
            cout<<endl;
            return 0;
    }

  • 相关阅读:
    示例 json with js
    JS json
    jquery
    发布包规范
    20180320待编辑
    CefSharp中c#和js交互
    列举mvc ActionResult的返回值
    怎么实现第三方登录
    mvc @Html控件
    MVC webuploader 图片
  • 原文地址:https://www.cnblogs.com/sxy201658506207/p/7586407.html
Copyright © 2011-2022 走看看