-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution_05_advanced.c
More file actions
55 lines (40 loc) · 1.11 KB
/
solution_05_advanced.c
File metadata and controls
55 lines (40 loc) · 1.11 KB
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
/* Main function of the C program. */
#include <stdio.h>
#include <stdlib.h>
int main()
{
int count = 3; // unsere maximale Themenzahl
int i; // Laufvariable für die Schleifen
int input; // vom Nutzer gewähltes Thema
do
{
printf("Wähle ein Themengebiet.\n");
printf("=======================\n");
printf("\n");
for (i = 0; i < count; i++)
{
printf("\t%d\tThema%d\n", i + 1, i + 1);
}
printf("\n\t0\tBeenden\n\n");
printf("Bitte wähle ein Themengebiet: ");
scanf("%d", &input);
switch (input)
{
case 0:
printf("Programm wird beendet...\n");
break;
default:
//Diese if-Anweisung war in der Aufgabe nicht gefordert
if (input >= 1 && input <= count)
{
printf("Es wurde Thema%d ausgewählt\n", input);
}
else
{
printf("Ungültiges Themengebiert!\n");
}
break;
}
} while (input != 0);
return EXIT_SUCCESS;
}