This is the code that I have...
using
namespace
{
fileIn =
}
i = 1;
numArray[i] =
i++;
numArray[i] = --i;
k = i;
k = j;
tempValue = numArray[k];
numArray[k] = numArray[i];
numArray[i] = tempValue;
fileIn.Close();
ReadFiles();
DisplayArray();
SortValuesAscending();
CloseFiles();
I am supposed to write a program to read and display numbers from a file. I need 3 methods, ReadFile(),that will read 25 nums stored in a file and copy to an array named numArray. Then I need a method called DisplayArray(), and one named SortValuesAscending. I keep getting an error when I run the program, but am not understanding what I am doing wrong. this is the error I get...
\CIS110\prg11Dat.txt was opened
Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Program_11.Program.SortValuesAscending() in C:\CIS110\Program 11\Program.cs:line 59 at Program_11.Program.Main() in C:\CIS110\Program 11\Program.cs:line 97Press any key to continue . . .
Should I be sending the values from readfile to display file using pass by copy?? I am apparently new to this and confused, a dangerous combination for me!!
HELP...I know that it is probably an easy fix, but I am not sure what it is.