I need to display the grade each student has by asking for it’s number. The grade each student has is tied with each student, can be the array place of each. The Student number is what is prompted to ask the search in the array. Could it possibly be done in a short Two liner?
using System;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string[] studentName = {"Bob","Marie","Nathan","Lois","Sam"};
string[] studentsNumber = {"040707701","040707702","040707703","040707704","040707705"};
string[] studentGrade = {"A","B","C","D","F"};
string studentsNumber = "";
Console.WriteLine("What is your student number");
Console.ReadLine(studentsNumber.ToString());
for(int index = 0, studentNumber[studentNumber - 1], index++)
{
Console.WriteLine(studentsNumber[index]);
onsole.WriteLine(studentName[],studentGrade[] {0} {1});
}
}
}
}
Would be much better to have an object:
And then have a
List<StudentInfo>.By doing it this way your data will be tight together. Otherwise you might end up in a situation where you have different number of items in each array and you wouldn-t know which one is which.
Hope it helps.