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 ...
设计一个自动分析黑洞数并添加到判断中的程序,初测运行正常,如百度百科中列出的495,6174都正确自动识别添加到判断队列,以下是程序,欢迎测试,指正。本程序作为分析工具可较易扩展分析功能。
缘由https://bbs.bccn.net/viewthread.php?tid=499134&page=4&extra=#pid2718460
void 寻找黑洞数()
{
int shu = 47, shuan = shu, p = 0, j = 0, cf[44]{0}, 黑洞数[44]{0};
while (shu < INT_M...
int 数重组位最大(int 整数)
{ /*C++任意输入一个整数,再把它的各位数字重新组合一个新的整数,使其值最大*///缘由https://bbs.bccn.net/viewthread.php?tid=499134&pid=2718301&page=1#pid2718301
int 输入整数 = 整数, 数(0), 输出(0), 取值(0), 比较(0), 暂存(0), 位(0), 序(0), 反向(0);
bool 控制(true);
if (输入整数 < 100)输入整数 *= 10;
if (输入整数 > 1000)输入整数 /= 10;...
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'&&aa[j] <= '9')++a;
else if (aa[j] >= 'a'&&aa[j] <= 'z' || aa[j...
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;...
int 返回月的天数(int 年, int 月)
{//缘由https://bbs.csdn.net/topics/395074486
return (月 == 2 ?
((((!(年 % 4) && 年 % 100) || !(年 % 400)) ? 1 : 0) ? 29 : 28) :
(((月 <= 7 && 月 % 2) || (月>7 && !(月 % 2))) ? 31 : 30));
}
int 返回年总天数(int 年)
{
return ((年) ? 365 ...
int 返回日期总天数(int 年, int 月, int 日)
{
int 总天数 = 0;
if (月 == 12 && 日 == 31)总天数 = 返回年总天数(年);
else
{
while (--月)总天数 += 返回月的天数(年, 月);
总天数 += 日 + 返回年总天数(--年);
}
return 总天数;
}
int 日期差天数计算(int 起年, int 起月, int 起日, int 至年, int 至月, int 至日)
{
int 总天数 ...
按月计算当加减的天数很大时循环量就大,如240000/31~=7742,若用年月同时计算则可减少三百多倍循环量,提高效率。
void 按月计算的天日期(int 年, int 月, int 日, int 天, char 运算符 = '-')
{//缘由https://ask.csdn.net/questions/1052316
int 总天数 = 返回日期总天数(年, 月, 日);
if (运算符 == '-')while (日 <= 天)if (!--月)--年, 月 = 13; else 日 += 返回月的天数(年, 月);
//whi...
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星期...
int 返回月的天数(int 年, int 月)
{//缘由https://bbs.csdn.net/topics/395074486
return (月 == 2 ?
((((!(年 % 4) && 年 % 100) || !(年 % 400)) ? 1 : 0) ? 29 : 28) :
(((月 <= 7 && 月 % 2) || (月>7 && !(月 % 2))) ? 31 : 30));
}
int 返回年总天数(int 年)
{
return ((年) ? 365 * ...
private void 开花树() { /*下面自定义树顺序*/ 树.Nodes.Clear(); DataTable 表 = 加载数据(), 树表 = null; string[] 重组表列 = null; if (表.TableName == "人员") 重组表列 = new string[] { "归属", "姓名", "生日" }; if (表.TableName == "提示") 重组表列 = new string[] { "提示内容", "心情日记" }; ...
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"); }
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"...
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...
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...