📄 readonly2.cs
字号:
using System;
class Customer
{
public readonly string name;
public readonly int age;
public static int numofcustomer=0;
public Customer(string pname,int page)
{
name=pname;
age=page;
numofcustomer++;
}
public static void Main()
{
int choose=1;
while(choose==1)
{
Console.WriteLine("please input the customer's name and age:");
Console.Write("name:");
string str=Console.ReadLine();
Console.Write("age:");
string s=Console.ReadLine();
int a=int.Parse(s);
Customer customer=new Customer(str,a);
Console.WriteLine("Now there have been {0} customers.",numofcustomer);
Console.WriteLine("Is there another one?1=yes,2=no");
string ch=Console.ReadLine();
choose=int.Parse(ch);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -