Add solution for explizitesCasting.

This commit is contained in:
paulusja
2026-04-23 13:02:21 +02:00
parent 114a412778
commit 1a1837c7fb
3 changed files with 31 additions and 0 deletions
+15
View File
@@ -14,9 +14,24 @@
********************************************************************************************/
#include <stdio.h>
#include "../io/myio.h"
int main()
{
double price = 0;
unsigned int priceEuro = 0;
unsigned int priceCents = 0;
do
{
price = getDoubleNumber("Geben Sie einen Preis ein: ");
} while (price < 0);
priceEuro = (unsigned int)price;
priceCents = (unsigned int)((price - priceEuro)*100);
printf("Preis: %d Euros, %d Cents\n", priceEuro, priceCents);
return 0;
}