I have the following code. Where the grades of 5 students are requested, both of course A, as of B. And the highest average is shown. My query is as follows:
How do I also ask for the ordering form, either by name or by note?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PuntoUno
{
class PuntoUno
{
private int[] cursoa;
private int[] cursob;
public void Cargar()
{
cursoa = new int[5];
cursob = new int[5];
Console.WriteLine("Carga de notas del curso A: ");
for (int f = 0; f < 5; f++)
{
Console.Write("Ingrese nota de alumno: ");
string linea;
linea = Console.ReadLine();
cursoa[f] = int.Parse(linea);
}
Console.WriteLine("Carga de notas del curso B: ");
for (int f = 0; f < 5; f++)
{
Console.Write("Ingrese nota de alumno: ");
string linea;
linea = Console.ReadLine();
cursob[f] = int.Parse(linea);
}
}
public void CalculoPromedios()
{
int suma1 = 0;
int suma2 = 0;
for (int f = 0; f < 5; f++)
{
suma1 = suma1 + cursoa[f];
suma2 = suma2 + cursob[f];
}
int promedioa = suma1 / 5;
int promediob = suma2 / 5;
if (promedioa > promediob)
{
Console.WriteLine("El curso A tiene un promedio mayor.");
}
else
{
Console.WriteLine("El curso B tiene un promedio mayor.");
}
Console.ReadKey();
}
static void Main(string[] args)
{
PuntoUno pv = new PuntoUno();
pv.Cargar();
pv.CalculoPromedios();
}
}
}
Thanks