元旦快乐,阖家团圆,幸福安康.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication测试
{
class 自定义类
{
public string 中文月(int 月值)
{
return "一二三四五六七八九十冬腊"[月值].ToString() + "月";
}
public string 中文月(string 月文)
{
string 生肖 = "一月寅(虎)二月卯(兔)三月辰(龙)四月巳(蛇)五月午(马)六月未(羊)七月申(猴)八月酉(鸡)九月戌(狗)十月亥(猪)冬月子(鼠)腊月丑(牛)";
return 生肖.Substring(生肖.IndexOf(月文) + 2, 4);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication测试
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
自定义类 中文月份 = new 自定义类();
string 月文 = 中文月份.中文月(9);
MessageBox.Show(月文 + "·" + 中文月份.中文月(月文));
}
}
}