update
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "date.h"
|
||||
|
||||
void setDate(Date* date, int year){
|
||||
date->day = 1;
|
||||
date->month = 1;
|
||||
date->year = year;
|
||||
}
|
||||
|
||||
void prettyPrintDate(Date *date){
|
||||
printf("Day: %d Month: %d Year: %d \n", date->day,date->month,date->year);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef DATE_H
|
||||
#define DATE_H
|
||||
|
||||
typedef struct date{
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
} Date;
|
||||
|
||||
void setDate(Date *date, int year);
|
||||
|
||||
void prettyPrintDate(Date *date);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include "date.h"
|
||||
#include "highscore.h"
|
||||
|
||||
void setHighscore(Highscore *highscore, int score, int year){
|
||||
setDate(&highscore->date, year);
|
||||
highscore->score = score;
|
||||
}
|
||||
|
||||
void prettyPrintHighscore(Highscore *highscore){
|
||||
printf("The Highscore on the %d.%d.%d is %d \n", highscore->date.day,highscore->date.month,highscore->date.year,highscore->score);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef HIGHSCORE_H
|
||||
#define HIGHSCORE_H
|
||||
#include "date.h"
|
||||
|
||||
typedef struct highscore {
|
||||
Date date;
|
||||
int score;
|
||||
} Highscore;
|
||||
|
||||
void setHighscore(Highscore *highscore, int score, int year);
|
||||
|
||||
void prettyPrintHighscore(Highscore *highscore);
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int count = 1;
|
||||
|
||||
|
||||
void rec_out(int n);
|
||||
|
||||
void decr(int n)
|
||||
{
|
||||
rec_out(--n);
|
||||
@@ -9,7 +14,6 @@ void decr(int n)
|
||||
|
||||
void rec_out(int n)
|
||||
{
|
||||
int count = 1;
|
||||
printf("Die %d. Ausgabe.\n", count);
|
||||
count++;
|
||||
if (n > 1)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "date.h"
|
||||
#include "highscore.h"
|
||||
|
||||
int main(){
|
||||
|
||||
int year1 = 2024;
|
||||
int score1 = 10;
|
||||
|
||||
Highscore highscore;
|
||||
setHighscore(&highscore, score1, year1);
|
||||
prettyPrintHighscore(&highscore);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user