当前位置: > c#编写一个学生成绩计算程序,统计出一个班学生的某门课程各分数段的人数(分数段:90分以上,80-90,70-80,...
题目
c#编写一个学生成绩计算程序,统计出一个班学生的某门课程各分数段的人数(分数段:90分以上,80-90,70-80,
编写一个学生成绩计算程序,统计出一个班学生的某门课程各分数段的人数(分数段:90分以上,80-90,70-80,60-70,60分以下)
成绩的计算方式是:平时成绩*40%+期末成绩*60%=最终成绩.
并显示出该班该门课的最高成绩和学生姓名,最低成绩和学生姓名
求教怎么修改
下面粘代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace xx
{
class Program
{
static void Main(string[] args)
{
int[] score = new int[10]; string[] m = { };
int i, a, b, c, d, e;
a = b = c = d = e = 0;
double[] math = new double[10];
double t = 0, max, min, r;
//int i;
Console.WriteLine("请输入20名学生的成绩 每名学生成绩输入后按回车输入下一位");
for (i = 0; i < 10; i++)
score[i] = Convert.ToInt32(Console.ReadLine());
for (i = 0; i < 10; i++)
{
switch (score[i] / 10)
{提问时间:2021-02-26

答案
int[] score = new int[10]; string[] m = { };
int i, a, b, c, d, e;
a = b = c = d = e = 0;
double t = 0, max, min, r;
Console.WriteLine("请输入20名学生的成绩 以回车符区分");
for (i = 0; i < 10; i++)
{
int inputScore = 0;
if (!int.TryParse(Console.ReadLine(), out inputScore))
{
Console.WriteLine("请输入数字类型成绩");
i--;
}
score[i] = inputScore;
}
for (i = 0; i < 10; i++)
{
switch (score[i] / 10)
{
case 10:
case 9: a++; break;
case 8: b++; break;
case 7: c++; break;
case 6: d++; break;
default: e++;
break;
}
}
max = score[0];
min = score[0];
for (i = 0; i < 10; i++)
{
t += score[i];
if (score[i] > max) max = score[i];
if (score[i] < min) min = score[i];
}
r = t / 10;
Console.WriteLine("平均分为:{0}", r);
Console.WriteLine("最高分为:{0}", max);
Console.WriteLine("最低分为:{0}", min);
Console.WriteLine("得优人数 :{0}", a);
Console.WriteLine("得良人数 : {0}", b);
Console.WriteLine("得好人数 :{0}", c);
Console.WriteLine("及格人数 :{0}", d);
Console.WriteLine("不及格人数 :{0}", e);
Console.ReadLine();
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.