added ws202425 courses

This commit is contained in:
2024-11-14 13:11:04 +01:00
parent 800282c2e8
commit beb31897b1
461 changed files with 20368 additions and 0 deletions
@@ -0,0 +1,18 @@
#include <stdio.h>
unsigned long long explode(unsigned int m, unsigned short n);
int main(){
printf("2* 2^n: %llu", explode(2,3));
}
unsigned long long explode(unsigned int m, unsigned short n){
return m << n; // n mal nach links shiften m*2^n
}
struct Node {
int data;
struct Node *next;
};
Binary file not shown.
@@ -0,0 +1,17 @@
//date.c
#include <stdio.h>
#include "date.h"
struct date setInitDate(int year){
struct date d;
d.year = year;
d.month = 1;
d.day = 1;
return d;
}
void printDate(struct date * datum){
printf("date: %d.%d.%d \n", datum->day, datum->month, datum->year);
}
@@ -0,0 +1,13 @@
// date.h
#ifndef DATE_H
#define DATE_H
struct date{
int day, month, year;
};
struct date setInitDate(int year);
void printDate(struct date *d);
#endif
Binary file not shown.
@@ -0,0 +1,28 @@
//highscore.c
#include "highscore.h"
#include <stdio.h>
//define TEST
#if defined TEST
int main(){
struct highscore hs;
struct date datum = setInitDate(2077);
int score = 9001;
setHighscore(&hs, score, datum);
printHighscore(&hs);
return 0;
}
#endif
void setHighscore(struct highscore *hs, struct date datum, int newscore){
hs->date = datum;
hs->score = newscore;
}
void printHighscore(struct highscore * hs){
printf(" Scores ab %d \n", firstYear);
printf("your highscore: %d at date %d.%d.%d \n", hs->score, hs->date.day, hs->date.month, hs->date.year);
}
@@ -0,0 +1,18 @@
// highscore.h
#include "date.h"
#ifndef HIGHSCORE_H
#define HIGHSCORE_H
int firstYear;
struct highscore{
struct date date;
int score;
};
void setHighscore(struct highscore * hs, struct date datum, int newscore);
void printHighscore(struct highscore * hs);
#endif
@@ -0,0 +1,28 @@
// rec_static.c
#include <stdio.h>
void rec_out(int n);
void decr(int n);
int main(){
rec_out(6);
return 0;
}
void decr(int n){
rec_out(--n);
}
void rec_out(int n){
static int count = 1;
printf("Die %d. Ausgabe.\n", count);
count++;
if (n > 1){
decr(n);
}
}
Binary file not shown.
@@ -0,0 +1,13 @@
#include "highscore.h"
int firstYear = 2000;
int main(){
struct highscore hs;
struct date datum = setInitDate(2077);
int score = 9001;
setHighscore(&hs, datum, score);
printHighscore(&hs);
return 0;
}
Binary file not shown.
@@ -0,0 +1,25 @@
// rec_static.c
#include <stdio.h>
void decr(int n)
{
rec_out(--n);
}
void rec_out(int n)
{
int count = 1;
printf("Die %d. Ausgabe.\n", count);
count++;
if (n > 1)
{
decr(n);
}
}
int main()
{
rec_out(6);
return 0;
}
Binary file not shown.