• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >C#教程 > C#编写的生辰八字计算程序

C#编写的生辰八字计算程序

作者:徐步陌上行 字体:[增加 减小] 来源:互联网 时间:2017-05-28

徐步陌上行 通过本文主要向大家介绍了c#2012程序设计,c#程序设计,c#数据采集程序,c#面向对象程序设计,c#控制台应用程序等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

作者故意删除了注释,读不懂代码的,就加作者QQ721159175咨询吧,作者很乐意与你分享并解答~

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //假设一个人的公历出生时间,范围必须要在2012-2015年之间,因为本示例程序只提供了这几年的农历数据
            //修改这几个赋值,运行程序,可以得到生辰八字
            GuaZhu.nQiGuaYear = 2015;//年
            GuaZhu.nQiGuaMonth = 2;//月
            GuaZhu.nQiGuaDay = 6;//日
            GuaZhu.nQiGuaHour = 23;//时
            GuaZhu.nQiGuaMinute = 33;//分
            GuaZhu.GetSiZhu();
        }
    }
    public static class GuaZhu
    {
        public static int nQiGuaYear;
        public static int nQiGuaMonth;
        public static int nQiGuaDay;
        public static int nQiGuaHour;
        public static int nQiGuaMinute;
        public static int JieQiMonth;
        public static string PrevJQYear;
        public static string PrevJQMonth;
        public static string PrevJQDay;
        public static string PrevJQHour;
        public static string PrevJQMinute;
        public static string NextJQYear;
        public static string NextJQMonth;
        public static string NextJQDay;
        public static string NextJQHour;
        public static string NextJQMinute;
        public static string sSiZhu;
        public static string nTianGan;
        public static string yTianGan;
        public static string rTianGan;
        public static string sTianGan;
        public static string nDiZhi;
        public static string yDiZhi;
        public static string rDiZhi;
        public static string sDiZhi;
        public static int nTianGanID;
        public static int yTianGanID;
        public static int rTianGanID;
        public static string PrevJieQi;
        public static string NextJieQi;
        public static string[] TianGan = { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
        public static string[] DiZhi = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
        public static string[] JieQi = {
"1/6/2012 06:44","2/4/2012 18:22","3/5/2012 12:21","4/4/2012 17:06","5/5/2012 10:20","6/5/2012 14:26","7/7/2012 00:41",
"8/7/2012 10:31","9/7/2012 13:29","10/8/2012 05:12","11/7/2012 08:26","12/7/2012 01:19","1/5/2013 12:34","2/4/2013 00:13",
"3/5/2013 18:15","4/4/2013 23:02","5/5/2013 16:18","6/5/2013 20:23","7/7/2013 06:35","8/7/2013 16:20","9/7/2013 19:16",
"10/8/2013 10:58","11/7/2013 14:14","12/7/2013 07:09","1/5/2014 18:24","2/4/2014 06:03","3/6/2014 00:02","4/5/2014 04:47",
"5/5/2014 21:59","6/6/2014 02:03","7/7/2014 12:15","8/7/2014 22:03","9/8/2014 01:01","10/8/2014 16:48","11/7/2014 20:07",
"12/7/2014 13:04","1/6/2015 00:20","2/4/2015 11:58","3/6/2015 05:55","4/5/2015 10:39","5/6/2015 03:52","6/6/2015 07:58",
"7/7/2015 18:12","8/6/2015 04:01","9/8/2015 06:59","10/8/2015 22:43","11/8/2015 01:58","12/7/2015 18:53",
};
        public static void GetnGanZhi()
        {
            int year, year1, year2;
            year = GuaZhu.nQiGuaYear;
            if (GuaZhu.nQiGuaMonth == 1)
            {
                year -= 1;
            }
            else if (GuaZhu.nQiGuaMonth == 2)
            {
                DateTime lichun, birthday1;
                lichun = DateTime.Parse("2012-2-4 18:22");
                string birthday2;
                switch (GuaZhu.nQiGuaYear - 2012)
                {
                    case 0:
                        lichun = DateTime.Parse("2012-2-4 18:22");
                        break;
                    case 1:
                        lichun = DateTime.Parse("2013-2-4 00:13");
                        break;
                    case 2:

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • C#实现程序开机启动的方法
  • C#实现简单聊天程序的方法
  • C#编写的生辰八字计算程序
  • C#判断某程序是否运行的方法
  • C#程序最小化到托盘图标操作步骤与实现代码

相关文章

  • 2017-05-28C#数据结构与算法揭秘二 线性结构
  • 2017-05-28C#中this用法系列(二) 通过this修饰符为原始类型扩展方法
  • 2017-05-28C#实现winform渐变效果的方法
  • 2017-05-28DevExpress之TreeList用法实例总结
  • 2017-05-28在C#的类或结构中重写ToString方法的用法简介
  • 2017-05-28C#调用SQLite的方法实例分析
  • 2017-05-28深入理解C#实现快捷键(系统热键)响应的方法
  • 2017-05-28c#使用Dataset读取XML文件动态生成菜单的方法
  • 2017-05-28C#遍历操作系统下所有驱动器的方法
  • 2017-05-28C#反序列化到类的实现方法

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • C#实现rar压缩与解压缩文件的方法
    • C#使用timer实现的简单闹钟程序
    • C#生成PDF文件流
    • WinForm绘制圆角的方法
    • C#网页分页标签生成
    • c#一个定时重启的小程序实现代码第1/2页
    • WinForm窗体间传值的方法
    • C#使用DeflateStream解压缩数据文件的方法
    • C#获取Word文档中所有表格的实现代码分享
    • 解析C#中委托的同步调用与异步调用(实例详解)

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有