-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
43 lines (41 loc) · 1018 Bytes
/
Program.cs
File metadata and controls
43 lines (41 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
namespace CSharpSorting
{
class MainClass
{
public static void Main(string[] args)
{
Random random = new Random();
//Make a random list of unsorted values and list them
int[] values = new int[10];
Console.WriteLine("Unsorted:");
for (int i = 0; i < values.Length; i++)
{
values[i] = random.Next(1, 100);
Console.WriteLine(values[i]);
}
//Bubble Sorting
int[] bubbled = Sort.bubble(values);
Console.WriteLine("Bubble Sorted:");
for (int i = 0; i < bubbled.Length; i++)
{
Console.WriteLine(bubbled[i]);
}
int[] selected = Sort.selection(values);
Console.WriteLine("Selection Sorted:");
for (int i = 0; i < selected.Length; i++)
{
Console.WriteLine(selected[i]);
}
//Insertion sorting
int[] inserted = Sort.insertion(values);
Console.WriteLine("Insertion Sorted:");
for (int i = 0; i < inserted.Length; i++)
{
Console.WriteLine(bubbled[i]);
}
//keep the console open :P
Console.ReadLine();
}
}
}