![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
函数库
hhdmw
这个作者很懒,什么都没留下…
展开
-
编写函数,将一个数据插入有序数组,要求插入后数组仍然有序
#includeusing namespace std;void sort(int array[], int n);void insert(int b[], int n, int data);const int N = 10;void main(){int i, array[N + 1], data;cout for (i = 0; i cin >> arr原创 2017-11-28 20:16:40 · 5412 阅读 · 0 评论 -
编写函数,输出大于a小于b的所有偶数,主函数读入两个正整数
#includeusing namespace std;void f(int a, int b);void main(){int a, b, tem;cin >> a >> b;if (a > b){tem = a;a = b;b = tem;}f(a, b);}void f(int a, int b){int i, j;原创 2017-11-26 23:27:23 · 1140 阅读 · 0 评论 -
编写函数,用递归法将一个n位整数转换为n个相应的字符
#includeusing namespace std;void intToChar(int n);void main(){int n;cout cin >> n;cout if (n {n = -n;cout }intToChar(n);}void intToChar(int n){int c;char ch;原创 2017-11-26 23:06:35 · 981 阅读 · 0 评论 -
编写函数,判断year是否为闰年,若是则返回1,否则返回0
#include using namespace std;int hhh(int year){int x;if (year % 100 != 0 && year % 4 == 0 || year % 100 == 0 && year % 400 != 0)x = 1;else x = 0;return x;}void main(){int a;c原创 2017-11-21 16:00:01 · 18448 阅读 · 0 评论 -
编写函数,其功能是求3个整数的最大值和最小值
includeusing namespace std;int max(int x,int y,int z){int t;if (x >y)t = x;else t = y;if (z > t)t = z;return t;}int min(int x,int y,int z){int t;if (x <y原创 2017-11-21 15:40:06 · 13404 阅读 · 0 评论 -
编写函数,已知三角形三边长,求三角形面积
#includeusing namespace std;double hhh(double a,double b ,double c ){double p;double s;p =( a + b + c)/2;s = sqrt(p*(p - a)*(p - b)*(p - c));return s; }void main(){do原创 2017-11-21 15:41:39 · 14167 阅读 · 0 评论 -
编写函数,将一维数组(array[10])的元素从小到大排序,在主函数中读入数组的元素
#includeusing namespace std;void hhh(int array[10]){int i, j, t;for (i = 0; i for(j=0;jif (array[j] >array[j + 1]){t = array[j];array[j] = array[j + 1];array[j + 1] = t;原创 2017-11-21 15:44:33 · 12352 阅读 · 0 评论