超过一名学生的分数百分比 [英] percentage of marks of more than one student

查看:94
本文介绍了超过一名学生的分数百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望用户分别输入学生的姓名和科目的标记.....&之后该程序将给出学生姓名的百分比输出。

i want user to enter the name of student & marks of their subjects respectivly.....& after that program ''ll give output of percentages with name of students.

推荐答案



请详细说明你的问题。

你可以在你的任务中尝试这个公式

marks / totalmarks * 100

u'将以百分比结束。
Hi,
Please Elaborate your problem.
You can try this formula in ur task
marks/totalmarks*100
u ''ll get out put with percentages.


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

using System.Collections.Specialized;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();

            int __english_max_marks = 100;
            int __maths_max_marks = 100;
            int __science_max_marks = 100;

            do
            {
                Console.WriteLine("");
                Console.Write("Enter Name Of Student : ");
                string studentName = Console.ReadLine();

                ArrayList al = new ArrayList();

                int[] ArrMarks = new int[3];

                Console.Write("Enter Marks Of English : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[0]);
                Console.Write("Enter Marks Of Maths : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[1]);
                Console.Write("Enter Marks Of Science : ");
                int.TryParse(Console.ReadLine(), out ArrMarks[2]);

                ht.Add(studentName, ArrMarks);

                Console.WriteLine("Would You Like To Read More Records ? Y/N");
            }
            while (Console.ReadKey().KeyChar.ToString().ToUpper() == "Y");

            Console.WriteLine("");
            Console.WriteLine("");

            foreach (string sk in ht.Keys)
            {
                int[] Arr = (int[])ht[sk];

                int all_marks = __english_max_marks + __maths_max_marks + __science_max_marks;

                float __percent = ((Arr[0] + Arr[1] + Arr[2]) * 100) / all_marks;

                Console.WriteLine(sk + " : " + __percent + " %");
            }

            Console.WriteLine("");
            Console.WriteLine("Press a key to Quit !");
            Console.ReadKey();
        }
    }
}


这篇关于超过一名学生的分数百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆