const int months = 12;
const int weeks = 52;
const int days = 365;
const double daysPerWeek = (double)days / weeks;
const double daysPerMonth = (double)days / months;
string name = "Tom";
int annualSalary = 500000;
float monthSalary = annualSalary / months;
float weekSalary = annualSalary / weeks;
float daySalary = annualSalary / days;
Console.WriteLine("常量变量的演示 :");
Console.WriteLine("double型常量的值daysPerWeek的值是{0}", daysPerWeek);
Console.WriteLine("double型常量的值daysPerMonth的值是{0}", daysPerMonth);
Console.WriteLine("{0}的月薪是{1}", name, annualSalary);
Console.WriteLine("{0}的月薪是{1}", name,monthSalary);
Console.WriteLine("{0}的周薪是{1}", name, weekSalary);
Console.WriteLine("{0}的日薪是{1}", name, daySalary);
Console.ReadKey();
运算符和表达式:
i = ++a 的意思就是 :
a=5
i = ++a
a= a+1
i=a
那么输出的 a =6 ,i=6
i= a++ → i = a , a = a+1.则输出的 i =5 , a = 6 .