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>
int zaehlen() {
static int counter = 0;
return ++counter;
}
// Symbolische Konstante
#define MWSTFAKTOR 0.19
int main() {
printf("Zähler: %d\n", zaehlen());
printf("Zähler: %d\n", zaehlen());
printf("Zähler: %d\n", zaehlen());
float betrag = 350.0;
float mwst = betrag * MWSTFAKTOR;
printf("%.f% von %.2f Euro: %.2f Euro\n", MWSTFAKTOR * 100, betrag, mwst);
return 0;
}