Эй, ребята. я бродил, если бы кто-нибудь знал, как создать код, чтобы консоль не открывалась, скорее отформатированная веб-страница.
любые предложения будут высоко оценены!
С уважением
namespace Grades
{
class Program
{
static void Main()
{
Console.WriteLine("\t\tValue Distribution\n");
String text = File.ReadAllText(@"values.dat"); //obviously change file path again
char[] c = text.ToCharArray(); //convert to char array
var g = c.OrderBy(a => a); //order array
foreach (char group in g)
{
Console.WriteLine(group.ToString()); //loop, displaying ordered array
}
//
int aCount = c.Count(a => a == 'A'); //count all 'A' instances
int bCount = c.Count(b => b == 'B'); //count all 'B' instances
int cCount = c.Count(cc => cc == 'C'); //count all 'C' instances
int dCount = c.Count(d => d == 'D'); //count all 'D' instances
int eCount = c.Count(e => e == 'E'); //count all ''E' instances
int fCount = c.Count(f => f == 'F'); //count all 'F' instances
//
Console.WriteLine("\nA = {0}", aCount);
Console.WriteLine("B = {0}", bCount);
Console.WriteLine("C = {0}", cCount);
Console.WriteLine("D = {0}", dCount);
Console.WriteLine("E = {0}", eCount);
Console.WriteLine("F = {0}", fCount);
//multiplying amount in each group by 2
aCount = aCount * 2;
bCount = bCount * 2;
cCount = cCount * 2;
dCount = dCount * 2;
eCount = eCount * 2;
fCount = fCount * 2;
//outputs graph display
Console.WriteLine("\n0 10 20 30 40 50 60 70 80 90 100");
Console.WriteLine("| | | | | | | | | | |");
Console.WriteLine("**************************************************");
//outputs each grade according to the multiplied amount and is therefore displayed with asteriks
Console.Write(new String('*', aCount)); Console.Write(" A\n");
Console.Write(new String('*', bCount)); Console.Write(" B\n");
Console.Write(new String('*', cCount)); Console.Write(" C\n");
Console.Write(new String('*', dCount)); Console.Write(" D\n");
Console.Write(new String('*', eCount)); Console.Write(" E\n");
Console.Write(new String('*', fCount)); Console.Write(" F\n");