Simple array program
Ok, this is fairly simple I feel but Im doing something wrong,
Im trying to complete an excercise in a book of mine, basically says write a program with an array that a teacher coud use to keep track of 30 students test scores, it should be able to randomly assign grades from 1, 100 and then determine the average of the grades.
Well here is what I have but for some reason, I can't get it to generate the random number and add it to the array?
Ok, this is fairly simple I feel but Im doing something wrong,
Im trying to complete an excercise in a book of mine, basically says write a program with an array that a teacher coud use to keep track of 30 students test scores, it should be able to randomly assign grades from 1, 100 and then determine the average of the grades.
Well here is what I have but for some reason, I can't get it to generate the random number and add it to the array?
Code:
using System;
public class teachAssist
{
public static void Main()
{
int[] testScore = new int[30];
foreach (int grade in testScore)
{
System.Random rnd = new System.Random();
testScore = (int)rnd.Next(1, 101);
Console.WriteLine("Test Score of {0}.", grade);
}
}
}