摘要: 问题描述: 写一个函数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 空梦。 阅读(463) 评论(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 空梦。 阅读(187) 评论(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 空梦。 阅读(84) 评论(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 空梦。 阅读(221) 评论(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 空梦。 阅读(64) 评论(0) 推荐(0)