form1.cs

来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 46 行

CS
46
字号
#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

#endregion

namespace DoStatement
{
    partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void showSteps_Click(object sender, System.EventArgs e)
        {
            try
            {
                int amount = System.Int32.Parse(number.Text);

                steps.Text = "";
                string current = "";
                do
                {
                    int digitCode = '0' + amount % 10;
                    char digit = Convert.ToChar(digitCode);
                    current = digit + current;
                    steps.Text += current + "\r\n";
                    amount /= 10;
                }
                while (amount != 0);
            }

            catch
            {
                number.Text = "ERROR ENTRANCE";
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?