-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution_05_basic.c
More file actions
50 lines (37 loc) · 984 Bytes
/
solution_05_basic.c
File metadata and controls
50 lines (37 loc) · 984 Bytes
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
/* 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
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;
}
return EXIT_SUCCESS;
}