刚开始接触C#不久,自己尝试做了一个日历,说是说万年历哈其实只从1900开始算起哈,因为题目就是这样的。先贴一下题目;
实现传入一个年份后,输出改年份每个月的信息,星期和日期;
提示:1900.1.1刚好是星期一下面是代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _007_test6_万年历_
{
class Program
{
static void Main(string[] args)
{
Console.Write("请输入你要查询的年份:");
int currentYear = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
int x, y;
for (int i = 1; i <= 12; i++)//遍历每个月
{
x = WhatDay(currentYear, i);//得出某年某月的第一天是星期几
y = EveryMonthDays(currentYear, i);//得出某年某月的天数
int index;//计数器