Originally Posted by
django
Hehe, thanks. I thought of it, instead of using floating point, I could simply use int + precision. Then you would somehow have to demand that all numbers are entered with the same precision and you could simply compary numbers. But this is exactly what I am looking for, some kind of bare bones approach that works. A few hints how this is is done will suffice, I don't want to reinvent the wheel.
Do everything in pennies... $1000.00 is simply 100,000 pennies.
Code:
// inputs
int InputAsPennies( void )
{ float x;
printf("Enter amount : $ ");
scanf("%f",&x);
return (int) x * 100); }
// display dollars
void DisplayAsDollars(int Amount)
{ printf("$ %d.%d", Amount / 100, Amount % 100); }
Easy enough?