异常判断循环(C#-3)

Posted on Posted in c#
Tips: 本文创建于2013年12月2日,已超过 2 年,内容或图片可能已经失效!

异常捕获

[code lang="csharp"]
try {
//正常代码
}
catch {
//错误提示
}
[/code]

 

  • && || !
  • && ||:用表达式进行逻辑运算的时候,如果第一个已经成立,第二个不再运算
  • if(){}else if{}

[code lang="csharp"]
Console.WriteLine("输入评级:");
string input = Console.ReadLine();
decimal salary = 3000m;

switch(input){
case "A":
salary += 100;
break;
case "B":
case "C":
case "D":
salary += 200;
break;
default:
Console.WriteLine("输入有误!");
break;
}
Console.WriteLine(salary);
Console.ReadKey();

//while
int i = 0;
while (i <= 10) {
Console.WriteLine(i);
i++;
}
Console.ReadKey();

[/code]

» 转载请注明来源:若我若鱼 » 异常判断循环(C#-3)

Leave a Reply

Your email address will not be published. Required fields are marked *

seven + eight =