摘要: 1.通讯录排序: #include<stdio.h> struct birthday{ int year; int month; int day; }; struct frineds{ char name[2]; struct birthday bd; int number; }; int main 阅读全文
posted @ 2019-06-24 23:18 黄月香 阅读(169) 评论(1) 推荐(0) 编辑
摘要: 1. 本题要求实现一个拆分实数的整数与小数部分的简单函数。函数接口定义:void splitfloat( float x, int *intpart, float *fracpart ); 其中x是被拆分的实数(0≤x<10000),*intpart和*fracpart分别是将实数x拆分出来的整数部 阅读全文
posted @ 2019-06-19 20:25 黄月香 阅读(395) 评论(0) 推荐(0) 编辑
摘要: 杨辉三角: #include <stdio.h>#define N 14void main(){ int i, j, k, n=0, a[N][N]; while(n<=0||n>=13){ printf("请输入要打印的行数:"); scanf("%d",&n); } printf("%d行杨辉三 阅读全文
posted @ 2019-06-10 23:35 黄月香 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1.选择法排序。输入一个正整数n(1<n<=10),再输入n个整数,将它们从大到小排序后输出。试编写相应程序。 #include<stdio.h> int main(void) { int a[10],n,i,k,temp,index; printf("输入一个正整数:"); scanf("%d", 阅读全文
posted @ 2019-06-10 22:07 黄月香 阅读(314) 评论(0) 推荐(0) 编辑
摘要: P145 3.使用函数输出指定范围内的完数,输入两个正整数m和n(1<=m,n<=1000),输出m~n之间的所有完数,完数就是因子和与它本身相等的数,要求定义被调用函数factorsum(number),它的功能是返回number的因子和。例如,factorsum(12)的返回值是16(1+2+3 阅读全文
posted @ 2019-05-28 20:05 黄月香 阅读(509) 评论(0) 推荐(0) 编辑
摘要: 编程: #include<stdio.h>#include<math.h> int prime(int m);int main(int argc,char const *argv[]){ int m,n,i; int sum=0,count=0; printf("请输入两个正整数:"); while 阅读全文
posted @ 2019-05-06 23:39 黄月香 阅读(282) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(void){ int m,n,a,b,c; printf("Enter two number:\n"); scanf("%d%d",&m,&n); if(m<n) { c=m;m=n;n=c; } b=m*n; a=m%n; while(a!=0) 阅读全文
posted @ 2019-04-15 18:22 黄月香 阅读(211) 评论(1) 推荐(0) 编辑
摘要: 1.判断三角形: #include<stdio.h>#include<math.h>int main(){ double x1,y1,x2,y2,x3,y3,a,b,c,n,t,s; printf("Enter x1 y1:"); scanf("%lf%lf",&x1,&y1); printf("E 阅读全文
posted @ 2019-04-10 17:02 黄月香 阅读(158) 评论(1) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-04-01 21:25 黄月香 阅读(185) 评论(2) 推荐(0) 编辑
摘要: 心得总结: 1.先写框图再写程序,框图一定一。 2.大括号位置一定要对,我打这两个编程时,两次出现大括号位置问题,然后我改了一两次才对。一定要注意大括号的位置。 3.小括号,引号,逗号什么的,我经常忘记。一定要检查好符号。并且要个区分大小写! 4.多个变量,多个%d。 5.%.1f一定要注意。 阅读全文
posted @ 2019-03-20 00:07 黄月香 阅读(893) 评论(0) 推荐(0) 编辑