饮水思源:金老师的自学网站

1、编写一个简单的控制台程序。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "my title" + DateTime.Now;
            Console.ForegroundColor = System.ConsoleColor.DarkGreen;
            Console.BackgroundColor = System.ConsoleColor.White;

            Console.WriteLine("Hello worldd 2019-04-28");
            
            String userinput = Console.ReadLine();
            Console.WriteLine("{0}这是两个占位符号{1}", userinput, userinput.Length);

            Console.Beep();
            Console.ReadKey(); // ReadKey是Console类的另一个方法,用于接收按键
            Console.ReadKey(true); // 添加true参数不回显所接收按键

            // 生成的.exe文件可运行在任何具有相应版本.NET的计算机上
        }
    }
}

2、日期计算的结构化编程实现

结构化编程一般设计步骤:

  1. 先设计数据结构。
  2. 基于数据结构确定算法。简单的情形是,将人的计算方法转化为计算机算法,每个算法步骤用一个函数实现。
  3. 进一步细化与调整方案
  4. 将整体装配成一个函数,得到最终设计方案

PPT截图:

C sharp #001# hello world

开发时,依据依赖关系由下至上。通常情况,避免跨层调用。

namespace CalculateDaysForSP
{
    //封装日期信息
    public struct MyDate
    {
        public int Year;    //
        public int Month;   //
        public int Day;     //
    }

}
MyDate.cs

相关文章:

  • 2021-12-12
  • 2021-10-05
  • 2022-12-23
  • 2021-04-18
  • 2021-06-10
  • 2022-01-30
  • 2021-08-08
  • 2021-12-04
猜你喜欢
  • 2021-12-22
  • 2021-08-11
  • 2022-12-23
  • 2021-06-30
  • 2021-10-31
  • 2021-09-28
  • 2022-01-26
相关资源
相似解决方案