- 博客(4)
- 收藏
- 关注
原创 函数strcmp的简单功能代码
strcmp在c和c++中代表的意思是比较两个字符串。 设这两个字符串为str1和str2。 若str1=str2,则返回零; 若str1<str2,则返回负数; 若str1>tr2,则返回正数; 其实也就是两个字符串从左到右逐个字符比较。(用ASCLL进行比较,也就是相减,但是要注意的就是确切的数值是依赖不同的c实现的) 百度百科里面有很详细的解释,也有不同的编译条件下的代码。 我这...
2018-12-15 17:16:44
649
转载 /*定义一个结构体变量(包括年月日)。 计算该日在本年中是第几天?注意闰年问题。 */
#include “stdafx.h” #include"cstdio" void day(int year, int month, int day); struct Time { int year,month,day; }; int main() { struct Time time; printf(“input the year,month,day\n”); scanf("%d %d %d",...
2018-12-05 14:51:44
2219
原创 用递归思想解决组合数问题
组合数 C(m,n)=m!/(n!*(m-n)!) 递归思想``C(m,n)= C(m - 1, n)+ C(m - 1, n - 1) 例如 C(3,2)=C(2,2)+C(2,1)=C(2,2)+C(1,1)+C(1,0)=1+1+1=3 #include "stdafx.h" #include"stdlib.h" int combination(int m, int n); void in...
2018-11-26 21:03:47
566
原创 **有一个三行每行80个字符的小短文,统计出短文中大写字母,小写字母,数字,空格和其他字符的个数**
分析一些题目可知,我们可以用两个for循环嵌套起来遍历每行的文字,然后用if语句对每一个文字进行判断,然后给相应的文字类型++,最后输出。 #include "stdafx.h" #include"stdlib.h" int judge(int cap, int low, int digit,int blank, int other); char easy[3][80]; int main() {...
2018-11-24 15:54:57
993
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅