第四讲选择程序的设计.pptVIP

  • 4
  • 0
  • 约1.1万字
  • 约 45页
  • 2017-04-01 发布于四川
  • 举报
第四讲选择程序的设计

4.5 switch语句 switch语句的格式: switch(表达式) {case 常量表达式1:语句1 case 常量表达式2:语句2 … case 常量表达式n:语句n default :语句n+1 } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 4.5 switch语句 例: 要求按照考试成绩的等级输出百分制分数段,用 switch语句实现:   switch(grade) {case ′A′∶printf(″85-100\n″); case ′B′∶printf(″70-84\n″); case ′C′∶printf(″60-69\n″); case ′D′∶printf(″60\n″); default∶printf(″error\n″); } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright

文档评论(0)

1亿VIP精品文档

相关文档