Compare commits

...

No commits in common. "main" and "master" have entirely different histories.
main ... master

6 changed files with 85 additions and 2 deletions

View File

@ -1,2 +0,0 @@
# Sortieren

10
Sortieren/.classpath Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
Sortieren/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bin/

17
Sortieren/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Sortieren</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

43
Sortieren/src/Sort.java Normal file
View File

@ -0,0 +1,43 @@
import java.util.Random;
public class Sort {
public static void main(String[] args) {
nichtmin();
}
public static void nichtmin() {
Random rand = new Random(50);
int[] arr = new int[20];
for (int i = 0; i < arr.length; i++) {
arr[i] = rand.nextInt(50);
}
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + ",");
}
int index = minindex(arr);
int minimum = arr[index];
System.out.println("Index" + index + ", Wert " + minimum);
arr[index] = 500;
int index2 = minindex(arr);
int minimum2 = arr[index];
}
public static int minindex(int arr[]) {
int min = arr[0];
int minindex = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] < min) {
min = arr[i];
minindex = i;
}
}
return minindex;
}
}