热门

最新

红包

立Flag

投票

同城

我的

发布
dajy666
我不是小默姐
3 年前
truedajy666

我是来学习的

灌水乐园
CSDN App 扫码分享
分享
1
2
打赏
  • 复制链接
  • 举报
下一条:
《C语言第三版课后习题》8课后习题8.6写一函数concat,将两个字符串连接#include<stdio.h>#include<string.h>int main() { char str1[100],str2[100]; gets(str1); gets(str2); strcat(str1,str2); puts(str1); return 0;}课后习题8.7写一函数cpy,将一个字符串中的元音字母复制到另一个字符串,然后输出。#include <stdio.h>#include <string.h>char ycopy(char x[], char y[]); int main(){ char a[20], b[20]; gets(a); b[20]=ycopy(a, b); puts(b); return 0;}char ycopy(char x[], char y[]) { int m, i, j; m=strlen(x); for (i=0, j=0; i<m; i++) { if (x[i]=='a'||x[i]=='A') y[j++]=x[i]; else if (x[i]=='e'||x[i]=='E') y[j++]=x[i]; else if (x[i]=='i'||x[i]=='I') y[j++]=x[i]; else if (x[i]=='o'||x[i]=='O') y[j++]=x[i]; else if (x[i]=='u'||x[i]=='U') y[j++]=x[i]; } y[j] = '\0'; return y[j];}课后习题8.8写一函数insert,输入一个四位数字,要求输出这四个数字字符,但每两个数字间空格。如输入1990,应输出"1 9 9 0"。#include<stdio.h>#include<string.h>int main() { char a[10]; gets(a); for(int i=0; i<strlen(a); i++) printf("%c ",a[i]); return 0;}
立即登录