So I am trying to make a list of how many goals a couple of guys did in one year.
It is supposed to be sorted in a bubble sort list. But all that is happening is that I get error codes.
I want each player to be able to input how many goals he did that season. And then the results should be output onto the screen in a sorted list.
Highest first and players in a list.
The code looks like this below. I have also pasted the wrong-message I get about “Main” but I don’t quite understand it. Should I put / before the word Main in the code or what?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Form_App
{
class GFG
{
static void bubbleSort(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
for (int j = 0; j < n - i - 1; j++)
if (arr[j] > arr[j + 1])
{
// swap temp and arr[i]
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
/* Prints the array */
static void printArray(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n; ++i)
Console.Write(arr[i] + " ");
Console.WriteLine();
}
// Driver method
public static void Main()
{
int[] arr = { 64, 34, 25, 12, 22, 11, 90 };
bubbleSort(arr);
Console.WriteLine("Sorted array");
printArray(arr);
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_hello_Click(object sender, EventArgs e)
{
lbl_hellomessage.Text = "Nice to meet you";
}
private void Sortera_Click(object sender, EventArgs e)
{
lbl_hellomessage.ForeColor = Color.Red;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
}
}