#include<stdio.h> #include<stdlib.h> void Dle(char* s,char c) { int n; for (n = 0; *(s + n) != '.'&& *(s + n-1) != NULL; n++) { if (*(s + n) == c)while (1) { *(s + n) = *(s + n + 1); n++; if (*(s + n) == NULL)break; } } puts(s); } void Ins(char* s, char z,char c) { int n,m,t,l; m = strlen(s); for (n = 0; *(s + n) != '.'; n++)if (*(s + n) == z)l=n; for (t = m+1;t>=l; t--)*(s + t) = *(s + t - 1); *(s + l) = c; puts(s); } void Re(char* s, char z, char c) { int n,t=0; for (n = 0; *(s + n) != NULL; n++)if (*(s + n) == z)*(s + n) = c,t++; if (t == 0)printf("no exist\n"); else puts(s); } int main() { char A[50], * s, C, B; gets(A); s = A; scanf("%c ", &C); if (C == 'D')scanf("%c", &B), Dle(s, B); else if (C == 'I')scanf("%c %c", &C, &B), Ins(s, C, B); else scanf("%c %c", &C, &B), Re(s, C, B); }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:645 |
点我有惊喜!你懂得!浏览:1238 |
点我有惊喜!你懂得!浏览:2707 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:1071 |
C二级辅导-同因查找 (C语言代码)浏览:585 |
C二级辅导-公约公倍 (C语言代码)浏览:1509 |
C语言考试练习题_排列 (C语言代码)浏览:1326 |
上车人数 (C语言代码)浏览:781 |
C语言训练-大、小写问题 (C语言代码)浏览:732 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1311 |