
程序
关于涤生
撑起两根穷骨头,养活一团春意思
展开
-
<源代码>冒泡排序法.cpp
#include<iostream>using namespace std;void bubble_sort(int grade[], int n) //冒泡排序法——从小到大。{ int i, j, temp; for (i = 0; i < n; i++) //每一次循环后都使得最大的第i数放到了倒数第i个位置 for (j = 0; j < n - i; j++) //两两比较大小 {原创 2020-11-14 05:29:42 · 216 阅读 · 0 评论 -
<程序>汉诺塔与递归的理解
作者:IT边界链接:https://www.zhihu.com/question/24385418/answer/128213752来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。汉诺塔永远只有三步:作者:梁大炮链接:https://www.zhihu.com/question/24385418/answer/252603808来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。要用程序来解决这个问题,我们先定义一个移动函数:.原创 2020-11-07 04:52:51 · 260 阅读 · 0 评论 -
<程序>输入年份,月份——打印月历
#include <iostream>#include<iomanip>#include<cmath>using namespace std;int zeller(int y, int m){ int w, c = y / 100; y %= 100; w = y + y / 4 + c / 4 - 2 * c + 13 * (m + 1) / 5 ; w %= 7; w >= 0 ? w : w += 7; return w;}int原创 2020-11-01 18:36:54 · 653 阅读 · 1 评论 -
键盘控制光标移动作业
#include <iostream>#include <cstdio>#include <conio.h>#include <time.h>#include <windows.h>#include <cstdlib>using namespace std;const int MAX_X = 69; //定义*组成的边框的宽度const int MAX_Y = 17; //定义*组成的边框的高度/*********原创 2020-11-01 13:22:59 · 704 阅读 · 0 评论 -
<程序>
打印由123456789组成的三个三位数,和为1953int a = 1, b, c, n = 1, x, y, z; //123 854 976 for (;a <= 5;a++) { for (b=a+1;b<=8;b++) { for (c = b + 1; c <= 9; c++)//百位结束,正确 { for (int a2=1; a2 <= 9; a2++) { if (a2 == a || a2 == b || a原创 2020-10-28 13:32:29 · 710 阅读 · 4 评论