Problem G: 零起点学算法102——删除字符
#include<stdio.h>
#include<string.h>
int main()
{
char ch[],a;
while(gets(ch)!=NULL)
{
scanf("%c",&a);
getchar();
getchar();
for(int i=;ch[i]!='\0';i++)
{
if(ch[i]!=a)
printf("%c",ch[i]);
}
printf("\n");
}
return ;
}
HINT
char str[],a;
while(gets(str)!=NULL)//多组测试数据
{
scanf("%c",&a);
getchar();//注意加这一行,它的作用是将上一行输入的回车符号'\n'符号读入
for(i=;str[i]!='\0';i++) {
//写代码;找到a,用循环语句将数组左移1位置
}
//写代码;输出删除a后的数组
}
return ;
}
//可能第二行的字符后面有空格或者其他的东西,建议用gets来读第二行。
//用C++的可以把gets换成getline会更好
Problem G: 零起点学算法102——删除字符的更多相关文章
- Problem G: 零起点学算法106——首字母变大写
#include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...
- Problem G: 零起点学算法86——Fibonacc
#include<stdio.h> int main(){ ]={,,}; ;i<=;i++) { a[i]=a[i-]+a[i-]; } scanf("%d", ...
- Problem G: 零起点学算法27——等级分制度
#include<stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)!=EOF) +a* ...
- Problem H: 零起点学算法109——单数变复数
#include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...
- Problem D: 零起点学算法95——弓型矩阵
#include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem E: 零起点学算法34——3n+1问题
#include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...
- Problem K: 零起点学算法107——统计元音
#include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...
- Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...
随机推荐
- ie6下双边距的问题
1.ie6双边距情况 <div class="red"></div> <div class="blue"></div& ...
- 我用.htaccess做了些什么?
1.防图片盗链,减轻流量压力: 2.index.php 301转向到域名,有利于PR权重集中: 3.其它还不会,慢慢来…… 我是如何做的? <IfModule mod_rewrite.c> ...
- humble_USACO
Humble Numbers For a given set of K prime numbers S = {p1, p2, ..., pK}, consider the set of all num ...
- Eudyptula Challenge
http://www.eudyptula-challenge.org/ The Eudyptula Challenge What is it? The Eudyptula Challenge is a ...
- linux中字符串转换函数 simple_strtoul【转】
转自:http://blog.csdn.net/tommy_wxie/article/details/7480087 Linux内核中提供的一些字符串转换函数: lib/vsprintf.c [htm ...
- qt-creator
https://github.com/qt-creator/qt-creator https://github.com/qt-creator
- mongodb 学习笔记--- 基础知识
1.mongodb的安装 (1) mac使用brew 安装就好 brew install mongodb (2) mkdir /data/db 作为mongodb默认的数据目录 并 sudo chow ...
- php常见术语
什么是PHP? php是Hypertext Preprocessor的缩写,php是一种内嵌 HTML的脚本语言.PHP的独特语法混合了c,java和perl及PHP式的新语法.这门语言的的目标是让网 ...
- HIbernate学习笔记3 之 缓存和 对象的三种状态
一.hibernate一级缓存 * hibernate创建每个Session对象时,都会给该Session分配一块独立的缓冲区,用于存放Session查询出来的对象,这个分配给session的缓存区 ...
- C++变量类型转换
1:int转换为CString CString str; str.Format("As string: %d", int); 2:double转换为CString CString ...