I'm trying to fill 3 arrays with user input, it should look like this:
Enter account number 1: 29384
Enter the account balance: 1111
Enter the account holder last name: lastname
Enter account number 2: 34938
Enter the account balance: 2222
Enter the account holder last name: lastname2
Enter account number 3: 46372
Enter the account balance: 3333
Enter the account holder last name: lastname3
and so on...
I have my program set up with for loops to fill a 5 line array but it asks for all five account numbers first then goes onto the balance and so on
using System;
public class Array1
{
public static void Main()
{
int[] scores = new int[5];
int x;
string inputString;
int[] balance = new int[5];
int y;
for(x=0; x < scores.Length; ++x)
{
Console.Write("Enter account number {0} ", x + 1);
inputString = Console.ReadLine();
scores[x] = Convert.ToInt32(inputString);
}
for(y=0; y < balance.Length; ++y)
{
Console.Write("Enter the account balance ");
inputString = Console.ReadLine();
}
}
}
I'm sure there is a much better way to write this. Any help would be appreciated.