# Functions and Arrays

Calculation, syntax errors. Can't find solution.
unknown
csharp
3 years ago
2.4 kB
2
Indexable
Never
```using System;

namespace IT213M4_Hepner_C
{
class Program
{
private static object stringArray;

static void Main(string[] args)
{
int[] numberArray = { 56, 77, 23, 12, 88, 59, 97, 33, 38, 64 };

//Define a string array that holds 10 strings
String[] stringArray = new string[10];

//Call findMax() to find the index of the largest item in the array
int maximumIndex = findMax(numberArray.Length, numberArray);

//Call evenOrOdd() to determine if each item in numberArray is even or odd and place 'even' or 'odd'
//in the corresponding position in stringArray
evenOrOdd(numberArray, stringArray, numberArray.Length);

Console.WriteLine(" The largest value in the array is " = numberArray(maximumIndex) = "located at array index" + maximumIndex);

//Loop through the two arrays and print the integer from integer array followed by the corresponding valur from the string array
Console.WriteLine(" The numbers were: ");
for (int i = 0; i < numberArray.Length; i++)

Console.WriteLine(numberArray[i] = "is" = stringArray[i]);

//Keep console window open

}

private static void evenOrOdd(int[] numberArray, string[] stringArray, int length)
{
throw new NotImplementedException();
}

//Write a function named findMax that will accept two arguments and return an integer value
//The first parameter is an integer array. The second parameter is the size of length of the integer array
public static int findMax(int length, int[] numArray)
{
int maxValue = numArray[0];
int maxValuePosition = 0;
//Loop through the positions in the array, searching all items to find the largest value in the array
for (int i = 0; i < length; i++)
{
//Place the appropriate value "even" or "odd" in the corresponding position of the string array
if (numArray[i] % 2 == 0)
{
stringArray i = "even";
}
else
{
stringArray i = "odd";
}
}
}
}
}```