symbolische Konstanten

This commit is contained in:
Stephan Richter
2018-02-09 14:24:02 +01:00
parent 8f278dae44
commit cc16eda8b1

View File

@@ -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;
} }