aaaaa
This commit is contained in:
8
WS23_24/Anwendungsentwicklung/.idea/.gitignore
generated
vendored
Normal file
8
WS23_24/Anwendungsentwicklung/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
1
WS23_24/Anwendungsentwicklung/.idea/.name
generated
Normal file
1
WS23_24/Anwendungsentwicklung/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
FH
|
||||
2
WS23_24/Anwendungsentwicklung/.idea/Anwendungsentwicklung.iml
generated
Normal file
2
WS23_24/Anwendungsentwicklung/.idea/Anwendungsentwicklung.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
6
WS23_24/Anwendungsentwicklung/.idea/misc.xml
generated
Normal file
6
WS23_24/Anwendungsentwicklung/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$/../..">
|
||||
<contentRoot DIR="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
||||
8
WS23_24/Anwendungsentwicklung/.idea/modules.xml
generated
Normal file
8
WS23_24/Anwendungsentwicklung/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Anwendungsentwicklung.iml" filepath="$PROJECT_DIR$/.idea/Anwendungsentwicklung.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
WS23_24/Anwendungsentwicklung/.idea/vcs.xml
generated
Normal file
6
WS23_24/Anwendungsentwicklung/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,10 +1,8 @@
|
||||
package Klausur_ueb;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
@@ -15,10 +13,11 @@ public class StreamsTraining {
|
||||
public static void main(String[] args) {
|
||||
//startFib();
|
||||
//directFib();
|
||||
directFib2();
|
||||
//lorem();
|
||||
//System.out.println(fak(25));
|
||||
//System.out.println(fak(15));
|
||||
lorem2();
|
||||
//lorem2();
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +39,24 @@ public class StreamsTraining {
|
||||
.map(s->s[0])//only take s[0]
|
||||
.forEach(System.out::println);
|
||||
}
|
||||
static void directFib2(){
|
||||
IntStream.rangeClosed(0, 10)
|
||||
.mapToObj(n -> fibonacciiii(n))
|
||||
.forEach(System.out::println);
|
||||
}
|
||||
public static int fibonacciiii(int n) {
|
||||
if (n <= 1)
|
||||
return n;
|
||||
|
||||
int prev = 0;
|
||||
int curr = 1;
|
||||
for (int i = 2; i <= n; i++) {
|
||||
int next = prev + curr;
|
||||
prev = curr;
|
||||
curr = next;
|
||||
}
|
||||
return curr;
|
||||
}
|
||||
|
||||
static void lorem(){
|
||||
String lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
|
||||
|
||||
9
WS23_24/Anwendungsentwicklung/src/P10/Curry.scala
Normal file
9
WS23_24/Anwendungsentwicklung/src/P10/Curry.scala
Normal file
@@ -0,0 +1,9 @@
|
||||
package P10
|
||||
|
||||
object Curry {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val curriedSum: Double => Double => Double => Double => Double = a => b => c => d => a+b+c+d
|
||||
val curSum2 = curriedSum(1)(2)
|
||||
print(curSum2(3)(4))
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ object FrenchDude {
|
||||
startPascal(5)
|
||||
println(" ")
|
||||
startPascal2(5)
|
||||
println(" ")
|
||||
fib(5)
|
||||
}
|
||||
|
||||
def startPascal(n:Int):Unit={
|
||||
@@ -47,4 +49,27 @@ object FrenchDude {
|
||||
pascal2(newArr,n)
|
||||
println()
|
||||
}
|
||||
|
||||
def fib(n: Int): Unit = {
|
||||
def fibIn(x: Int, previous: Array[Int], current: Array[Int]): Unit = {
|
||||
def topOffset(off: Int): Int = {
|
||||
val newX = x + off
|
||||
if (newX >= 0 && newX < previous.length)
|
||||
previous(newX)
|
||||
else
|
||||
0
|
||||
}
|
||||
current(x) = topOffset(-1) + topOffset(0)
|
||||
print(current(x))
|
||||
print(" ")
|
||||
if (x < current.length - 1)
|
||||
fibIn(x + 1, previous, current)
|
||||
else if (current.length < n) {
|
||||
println()
|
||||
fibIn(0, current, new Array[Int](current.length+1))
|
||||
}
|
||||
}
|
||||
println(1)
|
||||
fibIn(0, Array(1), new Array[Int](2))
|
||||
}
|
||||
}
|
||||
|
||||
88
WS23_24/Anwendungsentwicklung/src/P11/test.c
Normal file
88
WS23_24/Anwendungsentwicklung/src/P11/test.c
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// Created by jordi on 1/8/24.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
void strcpy(char *duplikat, const char *original) {
|
||||
while ((*duplikat++ = *original++));
|
||||
}
|
||||
void strcpy2(char *duplikat, const char *original) {
|
||||
int i = 0;
|
||||
while ((duplikat[i] = original[i]) != '\0') {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
void aufgabe3(){
|
||||
printf("Aufgabe 3\n");
|
||||
char original[] = "Hallo Welt";
|
||||
|
||||
char duplikat[20];
|
||||
strcpy(duplikat, original);
|
||||
printf("Original: %s\n", original);
|
||||
printf("Duplikat: %s\n", duplikat);
|
||||
|
||||
char duplikat2[20];
|
||||
strcpy2(duplikat2, original);
|
||||
printf("Original: %s\n", original);
|
||||
printf("Duplikat: %s\n", duplikat2);
|
||||
}
|
||||
|
||||
|
||||
void tauschen(int* int1, int* int2){
|
||||
int tmp = *int2;
|
||||
*int2 = *int1;
|
||||
*int1 = tmp;
|
||||
}
|
||||
void aufgabe4(){
|
||||
int int1 = 1;
|
||||
int int2 = 2;
|
||||
|
||||
printf("Int1 is %d\n",int1);
|
||||
printf("Int2 is %d\n",int2);
|
||||
tauschen(&int1,&int2);
|
||||
printf("Nach dem Vertauschen:\n");
|
||||
printf("Int1 is %d\n",int1);
|
||||
printf("Int2 is %d\n",int2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ARRAY_SIZE 5
|
||||
|
||||
|
||||
void initializeArray(int arr[]) {
|
||||
printf("Geben Sie %d Ganzzahlen für das Array ein:\n", ARRAY_SIZE);
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
scanf("%d", &arr[i]);
|
||||
}
|
||||
}
|
||||
void printArray(int arr[]) {
|
||||
printf("Das Array lautet: ");
|
||||
int *ptr = arr;
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
printf("%d ", *(ptr + i));
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
int sumArray(const int arr[]) {
|
||||
int sum = 0;
|
||||
for (int i = 0; i < ARRAY_SIZE; i++) {
|
||||
sum += *(arr + i);
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void aufgabe5() {
|
||||
int arr[ARRAY_SIZE];
|
||||
initializeArray(arr);
|
||||
printArray(arr);
|
||||
int sum = sumArray(arr);
|
||||
printf("Die Summe der Elemente im Array beträgt: %d\n", sum);
|
||||
}
|
||||
|
||||
int main() {
|
||||
aufgabe3();
|
||||
aufgabe4();
|
||||
aufgabe5();
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
//
|
||||
// Created by jordi on 1/8/24.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("hallo");
|
||||
}
|
||||
Reference in New Issue
Block a user