Fork me on GitHub

题目1049:字符串去特定字符(简单字符判断)

题目链接:http://ac.jobdu.com/problem.php?pid=1049

详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus

参考代码:

//
//  1049 字符串去特定字符.cpp
//  Jobdu
//
//  Created by PengFei_Zheng on 26/04/2017.
//  Copyright © 2017 PengFei_Zheng. All rights reserved.
//
 
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cmath>
#define MAX_SIZE 10010
 
using namespace std;
 
char str[MAX_SIZE];
 
int main(){
    while(scanf("%s",str)!=EOF){
        char c;
        cin>>c;
        int len = (int)strlen(str);
        for(int i = 0 ; i < len ; i++){
            if(str[i]!=c){
                cout<<str[i];
            }
        }
        cout<<endl;
    }
}
/**************************************************************
    Problem: 1049
    User: zpfbuaa
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:1528 kb
****************************************************************/

 

posted @ 2017-04-26 22:19  伊甸一点  阅读(229)  评论(0编辑  收藏  举报