createaccount.cs
来自「csharp-solution,C#高效编程源码」· CS 代码 · 共 39 行
CS
39 行
using System;
class CreateAccount
{
static void Main()
{
BankAccount berts = NewBankAccount();
Write(berts);
BankAccount freds = NewBankAccount();
Write(freds);
}
static BankAccount NewBankAccount()
{
BankAccount created;
Console.Write("Enter the account number : ");
long number = long.Parse(Console.ReadLine());
Console.Write("Enter the account balance! : ");
decimal balance = decimal.Parse(Console.ReadLine());
created.accNo = number;
created.accBal = balance;
created.accType = AccountType.Checking;
return created;
}
static void Write(BankAccount toWrite)
{
Console.WriteLine("Account number is {0}", toWrite.accNo);
Console.WriteLine("Account balance is {0}", toWrite.accBal);
Console.WriteLine("Account type is {0}", toWrite.accType.Format());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?