题目1049:字符串去特定字符

 简单的模拟

getchar()的用法,吃掉多余的回车!!!!!

#include<stdio.h>
#include<stdlib.h>
#include<cstring>

int main()
{
	char s[10000];
	char c;
	int i=0;
	while(scanf("%s",s)!=EOF)
	{
		getchar();c=getchar();
		//scanf("%c",&c);
		for (i=0;s[i]!='\0';i++)
		{
			if(s[i]!=c)
			  printf("%c",s[i]); 
		}
		printf("\n");
	}
	return 0;
}

  

posted @ 2017-02-27 13:23  贱人郭  阅读(136)  评论(0编辑  收藏  举报