练习编程,顺手写了黑洞数123

void 黑洞数123(int 整数) { int 偶 = 0, 奇 = 0, 位 = 0, 数 = 整数; while (数 != 123) { cout << 数 << "->"; while (数)if (数 % 10 % 2)++奇, ++位, 数 /= 10; else ++偶, ++位, 数 /= 10; 数 = 偶 * 100 + 奇 * 10 + 位; if (数 < 100)数 *= 10; 偶 = 奇 = 位 = 0; cout << 数 << ends; } cout << endl; } int ...
默认分类 | 2020-02-10 08:23 | 阅读 3289 次 | 评论 0 条

C++寻找重排求差黑洞数(自动分析并添加)

设计一个自动分析黑洞数并添加到判断中的程序,初测运行正常,如百度百科中列出的495,6174都正确自动识别添加到判断队列,以下是程序,欢迎测试,指正。本程序作为分析工具可较易扩展分析功能。 缘由https://bbs.bccn.net/viewthread.php?tid=499134&amp;page=4&amp;extra=#pid2718460 void 寻找黑洞数() { int shu = 47, shuan = shu, p = 0, j = 0, cf[44]{0}, 黑洞数[44]{0}; while (shu < INT_M...
默认分类 | 2020-02-09 20:09 | 阅读 1710 次 | 评论 0 条

黑洞数

int 数重组位最大(int 整数) { /*C++任意输入一个整数,再把它的各位数字重新组合一个新的整数,使其值最大*///缘由https://bbs.bccn.net/viewthread.php?tid=499134&amp;pid=2718301&amp;page=1#pid2718301 int 输入整数 = 整数, 数(0), 输出(0), 取值(0), 比较(0), 暂存(0), 位(0), 序(0), 反向(0); bool 控制(true); if (输入整数 < 100)输入整数 *= 10; if (输入整数 > 1000)输入整数 /= 10;...
默认分类 | 2020-02-08 10:10 | 阅读 2561 次 | 评论 0 条

C++密码强度判断

void 判断密码强弱() {//缘由https://bbs.bccn.net/thread-499125-1-1.html char aa[44]{""}; cout << "输入密码必须大于6位的字母数字符号组合:" << ends; cin >> aa; int a = 0, b = 0, c = 0, j = 0; while (aa[j] != '\0') { if (aa[j] >= '0'&amp;&amp;aa[j] <= '9')++a; else if (aa[j] >= 'a'&amp;&amp;aa[j] <= 'z' || aa[j...
默认分类 | 2020-02-07 03:14 | 阅读 2037 次 | 评论 0 条

手把手教编写程序-士兵队列训练问题

1审阅题目后决定采用固定数组来处理,动态数组在之后自己去实现 2看2个示例先写一个100的数组并赋值为输入的数量,同时进行初始化后输出,观察程序是否按意图正常运行: int aa[100]{0},n=0,j=0; cout << "输入数量" << endl;cin>>n; while(j<n)aa[j]=1+j++; j=0;while(aa[j])cout<<aa[j++]<<ends;cout<<endl; 3依据题目条件先写一个报数2剔除的,把凡是报2的数组赋值为0即可 int bs=0;j=0; while(j<n){if(aa[j])++bs;...
默认分类 | 2020-02-06 04:01 | 阅读 2504 次 | 评论 5 条

C++计算日期两个经典算法:1.返回年总天数及年天数,2.返回月的天数.

int 返回月的天数(int 年, int 月) {//缘由https://bbs.csdn.net/topics/395074486 return (月 == 2 ? ((((!(年 % 4) &amp;&amp; 年 % 100) || !(年 % 400)) ? 1 : 0) ? 29 : 28) : (((月 <= 7 &amp;&amp; 月 % 2) || (月>7 &amp;&amp; !(月 % 2))) ? 31 : 30)); } int 返回年总天数(int 年) { return ((年) ? 365 ...
默认分类 | 2020-02-02 06:29 | 阅读 1208 次 | 评论 0 条

C++返回日期总天数,日期差天数计算

int 返回日期总天数(int 年, int 月, int 日) { int 总天数 = 0; if (月 == 12 &amp;&amp; 日 == 31)总天数 = 返回年总天数(年); else { while (--月)总天数 += 返回月的天数(年, 月); 总天数 += 日 + 返回年总天数(--年); } return 总天数; } int 日期差天数计算(int 起年, int 起月, int 起日, int 至年, int 至月, int 至日) { int 总天数 ...
默认分类 | 2020-02-02 06:27 | 阅读 1076 次 | 评论 0 条

C++按月计算的天日期

按月计算当加减的天数很大时循环量就大,如240000/31~=7742,若用年月同时计算则可减少三百多倍循环量,提高效率。 void 按月计算的天日期(int 年, int 月, int 日, int 天, char 运算符 = '-') {//缘由https://ask.csdn.net/questions/1052316 int 总天数 = 返回日期总天数(年, 月, 日); if (运算符 == '-')while (日 <= 天)if (!--月)--年, 月 = 13; else 日 += 返回月的天数(年, 月); //whi...
默认分类 | 2020-02-02 06:25 | 阅读 856 次 | 评论 0 条

C++C#输出阳历万年历

void 输出万年历(int 年, int 月, int 日) { int r = 1, z = r, nn = 年, yy = 月; nn = 年; yy = 月; while (nn)if (--yy)z += 返回月的天数(nn, yy); else --nn, yy = 13; nn = 返回月的天数(年, 月); yy = 1; cout << 年 << "年" << 月 << "月" << 日 << "日今天星期 " << (z + 日 - 1) % 7 << "\n星期日\t星期一\t星期二\t星期三\t星期四\t星期五\t星期...
默认分类 | 2020-02-02 06:23 | 阅读 1464 次 | 评论 0 条

C++计算日期两个经典算法,返回年总天数及年天数.

int 返回月的天数(int 年, int 月) {//缘由https://bbs.csdn.net/topics/395074486 return (月 == 2 ? ((((!(年 % 4) &amp;&amp; 年 % 100) || !(年 % 400)) ? 1 : 0) ? 29 : 28) : (((月 <= 7 &amp;&amp; 月 % 2) || (月>7 &amp;&amp; !(月 % 2))) ? 31 : 30)); } int 返回年总天数(int 年) { return ((年) ? 365 * ...
默认分类 | 2020-01-16 12:02 | 阅读 1653 次 | 评论 0 条

玄龙戏珠无级树

private void 开花树() { /*下面自定义树顺序*/ 树.Nodes.Clear(); DataTable 表 = 加载数据(), 树表 = null; string[] 重组表列 = null; if (表.TableName == "人员") 重组表列 = new string[] { "归属", "姓名", "生日" }; if (表.TableName == "提示") 重组表列 = new string[] { "提示内容", "心情日记" }; ...
我的程序 | 2012-07-20 14:38 | 阅读 1450 次 | 评论 0 条

怎么做“两个时间的比较”?[WEB学习示例]

DateTime Datejiancun = System.DateTime.Now;mimatishi = Convert.ToDateTime("2009-9-9"]);System.TimeSpan ts = Datejiancun - mimatishi;denglutj[2] = ts.Days; if (denglutj[2] >= 40) { Response.Redirect("User.aspx"); }
我的程序 | 2009-11-24 19:42 | 阅读 1048 次 | 评论 0 条

如何获取datalist里面子控件(如:dropdownlist)的值[WEB学习示例]

protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)//信息显示编辑与删除 { pages = Request["page"]; LinkButton LBut2 = (LinkButton)DataList1.Items[0].FindControl("LinkButton2"); LinkButton LBut3 = (LinkButton)DataList1.Items[0].FindControl("LinkButton3"...
我的程序 | 2009-11-24 19:28 | 阅读 1364 次 | 评论 0 条

请问如何动态实现播放语音文件[WEB学习示例]

using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq; p...
我的程序 | 2009-11-24 19:27 | 阅读 1141 次 | 评论 0 条

读取数据库动态创建目录树[WEB学习示例]

if (!Page.IsPostBack) { //TreeView1.Nodes.Clear(); TreeNode nNode = new TreeNode("在职"); TreeNode pNode = new TreeNode("离职"); TreeView1.Nodes.Add(nNode); TreeView1.Nodes.Add(pNode); } } protected void TreeView1_TreeNode...
我的程序 | 2009-11-24 19:23 | 阅读 1469 次 | 评论 1 条