symbolische Konstanten
This commit is contained in:
12
src/main.c
12
src/main.c
@@ -1,13 +1,11 @@
|
|||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
|
|
||||||
int zaehlen() {
|
// Symbolische Konstante
|
||||||
static int counter = 0;
|
#define MWSTFAKTOR 0.19
|
||||||
return ++counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Zähler: %d\n", zaehlen());
|
float betrag = 350.0;
|
||||||
printf("Zähler: %d\n", zaehlen());
|
float mwst = betrag * MWSTFAKTOR;
|
||||||
printf("Zähler: %d\n", zaehlen());
|
printf("%.f% von %.2f Euro: %.2f Euro\n", MWSTFAKTOR * 100, betrag, mwst);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user