function not running
int count = 1;
Console.WriteLine("Oyster Eating Competition\nHow many competitors are there?");
int numCompetitors = int.Parse(Console.ReadLine());
string[] names = new string[numCompetitors];
int[] oystersEaten = new int[numCompetitors];
for (int i = 0; i < numCompetitors; i++)
{
Console.WriteLine($"What is competitor number {count}'s name?");
names[i] = Console.ReadLine();
Console.WriteLine($"How many oysters did {names[i]} eat?");
oystersEaten[i] = int.Parse(Console.ReadLine());
count = count + 1;
}
static void bubbleSort(int[] oystersEaten)
{
int temp;
for (int i = 0;i < oystersEaten.Length - 1; i++)
{
for(int j = 0; j < oystersEaten.Length - (1 + i); j++)
{
if (oystersEaten[j] > oystersEaten[j + 1])
{
temp = oystersEaten[j + 1];
oystersEaten[j +1] = oystersEaten[j];
oystersEaten[j] = temp;
}
}
}
}
p.bubbleSort();
Console.WriteLine(string.Join(", ", oystersEaten));int count = 1;
Console.WriteLine("Oyster Eating Competition\nHow many competitors are there?");
int numCompetitors = int.Parse(Console.ReadLine());
string[] names = new string[numCompetitors];
int[] oystersEaten = new int[numCompetitors];
for (int i = 0; i < numCompetitors; i++)
{
Console.WriteLine($"What is competitor number {count}'s name?");
names[i] = Console.ReadLine();
Console.WriteLine($"How many oysters did {names[i]} eat?");
oystersEaten[i] = int.Parse(Console.ReadLine());
count = count + 1;
}
static void bubbleSort(int[] oystersEaten)
{
int temp;
for (int i = 0;i < oystersEaten.Length - 1; i++)
{
for(int j = 0; j < oystersEaten.Length - (1 + i); j++)
{
if (oystersEaten[j] > oystersEaten[j + 1])
{
temp = oystersEaten[j + 1];
oystersEaten[j +1] = oystersEaten[j];
oystersEaten[j] = temp;
}
}
}
}
p.bubbleSort();
Console.WriteLine(string.Join(", ", oystersEaten));it runs fine up until p.bubbleSort i think, im not sure how to call my function properly im just trying to use the sort to sort the array