O.k. so I'm trying to finish up my first semester of programing I C#. This is the last program I have to write before the final. I cannot for the life of me figure out what I'm doing wrong. Here is the deal.....We have a given array and we have to write a method to find the largest number in the array and a method the smallest number in the array. We then have to write a method to swap the largest and the smallest numbers in the array and then display the array(which should show the numbers swapped). Our swap method has to have 5 arguments. My program is finding the correct highest number and smallest number but the swap is giving me trouble. I don't know if I am passing the arguments incorrectly or not. If you can help, it would be much appreciate as I am about to pull all my hair out! Remember, I've only had one semester so I have to work within the parameters that I have learned . Here is my program below (I"m using visual studio 2005). My Loadarray is not working right now either so I just commented it out and loaded the array manually.
namespace
{
{44,75,42, 115, 98},
{55,33,77,26,89},
{51,2,66,23,82},
{66,41,58,27,32},
{54,62,28,94,3} };
FindMax(numbers,
FindMin(numbers,
SwapLargeSmall (numbers,
DisplayArray(numbers);
}
fileIn =
nums[i, j] =
i = 0;
j = 0;
max = nums[i, j];
m = 0;
n = 0;
nums[m, n] = max;
min = nums[i, j];
k = 0;
l=0;
min= nums[i, j];
nums[k,l] = min;
tempvalue = nums[m, n];
nums[m,n] = nums[k, l];
nums[k, l] = tempvalue;
nums[i, j + 2], nums[i, j + 3], nums[i, j + 4]);
fileIn.Close();