-
Notifications
You must be signed in to change notification settings - Fork 0
/
kegprak2.2.html
138 lines (135 loc) · 4.95 KB
/
kegprak2.2.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kegiatan Praktikum 2.2</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: blue;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #333;
}
.code {
margin-bottom: 20px;
padding: 10px;
border-left: 5px solid #007bff;
background-color: #f8f9fa;
color: #333;
overflow-x: auto;
}
.code pre {
margin: 0;
padding: 0;
white-space: pre-wrap;
tab-size: 4;
}
.ButtonStyle {
text-align: center;
margin-top: 20px;
}
.styled {
border: 0;
line-height: 2.5;
padding: 0 20px;
font-size: 1rem;
text-align: center;
color: #fff;
text-shadow: 1px 1px 1px #000;
border-radius: 10px;
background-color: rgb(52, 35, 6);
background-image: linear-gradient(
to top left,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.2) 30%,
rgba(0, 0, 0, 0)
);
box-shadow:
inset 2px 2px 3px rgba(255, 255, 255, 0.6),
inset -2px -2px 3px rgba(0, 0, 0, 0.6);
}
.styled:hover {
background-color: rgb(84, 60, 10);
}
.styled:active {
box-shadow:
inset -2px -2px 3px rgba(255, 255, 255, 0.6),
inset 2px 2px 3px rgba(0, 0, 0, 0.6);
}
</style>
</head>
<body>
<div class="container">
<h1>Selection Sort</h1>
<div class="code">
<pre><code> using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2._2_SelectionSort_Langkah_Rincian
{
internal class Program
{
static void Selectionsort(int[] array)
{
int nilai = array.Length;
for (int iterasi = 0; iterasi < nilai - 1; iterasi++)
{
Console.WriteLine("\niterasi {0}.", iterasi);
int maximalindex = 0;
for (int i = 1; i < nilai - iterasi; i++)
{
if (array[iterasi] < array[maximalindex])
{
maximalindex = i;
}
}
int tempatbariselemen = array[maximalindex];
array[maximalindex] = tempatbariselemen;
Console.WriteLine("Array setelah iterasi {0}.", iterasi);
MenampilkanArray(array);
}
}
static void MenampilkanArray(int[] array)
{
foreach (int angka in array)
{
Console.WriteLine(angka + " ");
}
Console.WriteLine();
}
static void Main(string[] args)
{
int[] array = { 2, 4, 6, 8, 10, 12, 14, 16 };
Console.WriteLine("Array sebelum pengurutan");
MenampilkanArray(array);
Selectionsort(array);
Console.WriteLine("\nArray setelah pengurutan");
MenampilkanArray(array);
}
}
}
</code></pre>
</div>
</div>
<div class="ButtonStyle">
<button class="favorite styled" onclick="window.location.href='kegprak2.1.html'" type="button">Previous</button>
<button class="favorite styled" onclick="window.location.href='index.html'" type="button">Home</button>
<button class="favorite styled" onclick="window.location.href='kegprak2.3.html'" type="button">Next</button>
</div>
</body>
</html>