首页 > 其他 > 详细

编写一段程序,运行时向用户提问“你考了多少分?(0~100)”,接受输入后判断其等级并显示出来。判断依据如下:等级={优 (90~100分);良 (80~89分);中 (60~69分);差 (0~59分);}

时间:2015-11-21 00:35:20      阅读:4432      评论:0      收藏:0      [点我收藏+]

 编写一段程序,运行时向用户提问“你考了多少分?(0~100)”,接受输入后判断其等级并显示出来。判断依据如下:等级={优 (90~100分);良 (80~89分);中 (60~69分);差 (0~59分);}

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace 贴吧01
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             int input;
14             //Console.WriteLine("你考了多少分?(0~100)");
15             while (true)
16             {
17                 Console.WriteLine("你考了多少分?(0~100)");
18                 input = Convert.ToInt32(Console.ReadLine());
19                 if ((input >= 90) && (input <= 100))
20                 {
21                     Console.WriteLine("");
22                     break;
23                 }
24                 else if (input >= 80)
25                 {
26                     Console.WriteLine("");
27                     break;
28                 }
29                 else if ((input >= 60) && (input <= 69))
30                 {
31                     Console.WriteLine("");
32                     break;
33                 }
34                 else if ((input >= 0) && (input <= 59)) //0-59
35                 {
36                     Console.WriteLine("");
37                     break;
38                 }
39                 else
40                 {
41                     Console.WriteLine("输入有误或者所输入的不是要求的有效成绩范围");
42                 }
43             }
44             Console.ReadKey();
45         }
46     }
47 }

 

编写一段程序,运行时向用户提问“你考了多少分?(0~100)”,接受输入后判断其等级并显示出来。判断依据如下:等级={优 (90~100分);良 (80~89分);中 (60~69分);差 (0~59分);}

原文:http://www.cnblogs.com/start-from-scratch/p/4982568.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!