我最亲爱的说

子非鱼,焉知鱼之乐.

导航

编程实践6-2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Achievement2
{
    class Program
    {
        static void Main(string[] args)
        {
            double dblStuScore;

            Console.WriteLine("        学生成绩管理系统");
            Console.WriteLine("        (输入-1退出系统)");

            do
            {
                Console.Write("\n请输入学生的成绩:");
                dblStuScore = Convert.ToDouble(Console.ReadLine());
                if (dblStuScore == -1)
                {
                    break;
                }
                if (dblStuScore < 0 || dblStuScore > 100)
                {
                    Console.WriteLine("你输入的成绩不合法,请重新输入!");
                }
                else
                {
                    Console.WriteLine(chA(dblStuScore));   
                }
            } while (true);

            Console.WriteLine("\n谢谢使用学生成绩管理系统!");
            Console.ReadKey();
        }
        public static string chA(double iA)
        {
            string strOutput;
            switch ((int)(iA / 10))
            {
                case 10:
                case 9:
                    strOutput = "优秀";
                    break;
                case 8:
                    strOutput = "";
                    break;
                case 7:
                    strOutput = "";
                    break;
                case 6:
                    strOutput = "及格";
                    break;
                default:
                    strOutput = "不及格";
                    break;
            }
           return "成绩等级:" + strOutput;
        }
    }
}

 

posted on 2012-12-05 11:19  我最亲爱的说  阅读(123)  评论(0编辑  收藏  举报