摘要: 问题描述: 有一个字符串,包含n个字符。写一个函数,将此字符串中从第m个字符开始的全部字符复制到另一个 字符串中。 代码展示: 1 #include<stdio.h> 2 #include<string.h> 3 void fun1(char str1[], char str2[], int m); 阅读全文
posted @ 2021-11-29 15:50 空梦。 阅读(419) 评论(0) 推荐(0)
摘要: 问题描述: 写一个函数squeeze(s1,s2),它删去字符串s1中与s2中的任意字符想匹配的字符。 代码展示: 1 #include<stdio.h> 2 #include<string.h> 3 int deleteSample(char str1[], char str2[]); 4 int 阅读全文
posted @ 2021-11-29 15:33 空梦。 阅读(105) 评论(0) 推荐(0)
摘要: 问题描述: 写一个函数getint,它把输入的一串数字字符转换成整数 代码展示: 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 int getint(char str[]); 5 int main(){ 6 char st 阅读全文
posted @ 2021-11-28 13:26 空梦。 阅读(457) 评论(0) 推荐(0)
摘要: 问题描述: 编写实现查找字符串s2在字符串s1中第一次出现的位置,若找到则返回位置,否则返回0. 代码展示: 1 #include<stdio.h> 2 #include<string.h> 3 int index(char str1[], char str2[]); 4 int main(){ 5 阅读全文
posted @ 2021-11-28 12:02 空梦。 阅读(174) 评论(0) 推荐(0)
摘要: 问题描述: 用递归的方法编写程序,输入一个非负整数,结果输出这个数的逆序十进制数。 代码展示: 1 #include<stdio.h> 2 void DiGui(int x); 3 int main(){ 4 int x; 5 printf("请输入非负十进制数:"); 6 scanf("%d",& 阅读全文
posted @ 2021-11-28 11:35 空梦。 阅读(76) 评论(0) 推荐(0)
摘要: 问题描述: 求给定的5个数中的最大值。 代码展示: 1 #include<stdio.h> 2 int main(){ 3 int a[5]; 4 int i; 5 int max = 0; 6 printf("请输入5个整数:"); 7 for(i=0; i<5; i++){ 8 scanf("% 阅读全文
posted @ 2021-11-28 11:29 空梦。 阅读(217) 评论(0) 推荐(0)
摘要: 问题描述: 输入年月日,计算该天是本年的第N天。如输入数据为y=2017,m=12,d=24,则输出结果N=358。 代码展示: 1 #include<stdio.h> 2 int isRunnian(int year); 3 int main(){ 4 int year,month,day; 5 阅读全文
posted @ 2021-11-28 11:20 空梦。 阅读(60) 评论(0) 推荐(0)
摘要: 问题描述: 编写一个函数digit(n,k),它回送n的从右边开始的第k个数字的值,例如digit(25469,3)=4, digit(724,4)=0 代码展示: 1 #include<stdio.h> 2 int digit(int num, int x); //num表示待查找的数,x表示从右 阅读全文
posted @ 2021-11-27 21:28 空梦。 阅读(288) 评论(0) 推荐(0)
摘要: 问题描述: 用递归法求n! 代码展示: 1 #include<stdio.h> 2 int diGui(int n); 3 int main(){ 4 int n; 5 int result; 6 printf("请输入n:"); 7 scanf("%d", &n); 8 result = diGu 阅读全文
posted @ 2021-11-27 21:07 空梦。 阅读(59) 评论(0) 推荐(0)
摘要: 问题描述: 输入5名大学生成绩4门功课的成绩,然后求出: (1)每个大学生的总分; (2)每门课程的平均分; (3)输出总分最高的学生的姓名和总分数; 代码展示: 1 #include<stdio.h> 2 #include<string.h> 3 struct Student{ 4 char na 阅读全文
posted @ 2021-11-27 21:01 空梦。 阅读(92) 评论(0) 推荐(0)