Newer
Older
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
#include <stdio.h>
#include <stdlib.h>
#include "datastructure.h"
#include "cds.h"
#include "tools.h"
#include "datetime.h"
int countCDs = 0;
sCD CDData[MAXCDS];
void createCD()
{
if (countCDs == MAXCDS)
{
puts("Maximum number of cds reached!");
exit(0);
}
clearScreen();
puts("Erfassung einer neuen CD");
printLine('=', 50);
(CDData + countCDs)->numberOfSongs = 0;
getText("Geben Sie bitte den Titel der CD ein:", 35, &(CDData + countCDs)->title, 0);
getText("Geben Sie bitte den Interpreten ein:", 35, &(CDData + countCDs)->artist, 1);
getNumber("Geben Sie bitte das Erscheinungsjahr ein:", &(CDData + countCDs)->publicationYear, 1982, 2022);
puts("Geben Sie bitte die Daten der Lieder ein:");
creatSong();
countCDs++;
}
void creatSong()
{
do
{
printf("Lied %i:\n", ((CDData + countCDs)->numberOfSongs) + 1);
getText("Geben Sie bitte den Titel des Liedes ein:", 35, &(CDData + countCDs)->Songs[(CDData + countCDs)->numberOfSongs].title, 0);
getText("Geben Sie bitte den Interpreten ein:", 35, &(CDData + countCDs)->Songs[(CDData + countCDs)->numberOfSongs].artist, 1);
inputTime("Geben Sie bitte die Dauer des Liedes ein\n (Format hh:mm:ss oder mm:ss):\n -> ", &(CDData + countCDs)->Songs[(CDData + countCDs)->numberOfSongs].duration);
(CDData + countCDs)->numberOfSongs++;
} while ((askYesOrNo("Moechten Sie noch ein weiteres Lied eingeben (j/n)?")) && ((CDData + countCDs)->numberOfSongs) < MAXSONGS);
}
void editCd()
{
puts("editCd");
waitForEnter();
}
void deleteCD()
{
puts("deleteCd");
waitForEnter();
}
void searchSong()
{
puts("deleteCd");
waitForEnter();
}
void sortCDs()
{
puts("SortCd");
waitForEnter();
}
void ListCDs()
{
for (int i = 0; i < countCDs; i++)
{
putchar('\n');
printf("Titel : %s\n", (CDData + i)->title);
printf("Erscheinungsjahr : %i\n", (CDData + i)->publicationYear);
printf("Anzahl Lieder : %i\n", (CDData + i)->numberOfSongs);
puts("Lieder");
for (int j = 0; j < (CDData + i)->numberOfSongs; j++)
{
listOneSong(i, j);
}
}
waitForEnter();
}
void listOneSong(int i, int j)
{
printf("%.1i. %s (%s; ", (j + 1), (CDData + i)->Songs[j].title, (CDData + i)->Songs[j].artist);
printTime((CDData + i)->Songs[j].duration, 1);
puts(")");
}