Where do you run the code? my windows command prompt bricks on the start of this function.
Would you mind if i posted the whole code?
Code:
int thou, fhun, thun, hun, fty, tty, ten, five, one, tfcent, ChangeDecimal;
thou = fhun = thun = hun = fty = tty = ten = five = one = tfcent = 0;
int c1 = Change / 100;
int c2 = Change % 100;
Change = Denomination - PurchasePrice;
if(Change < 0)
{
int d1 = Denomination / 100;
int d2 = Denomination % 100;
int p1 = PurchasePrice / 100;
int p2 = PurchasePrice % 100;
printf("PHP%d.%02d is not enough to pay for PHP%d.%02d item.", d1, d2, p1, p2);
}
else
{
while (Change >= 0)
{
if (Change/100000 >= 1)
{
thou++;
Change = Change - 100000;
}
else if ((Change/50000) >= 1)
{
fhun++;
Change = Change - 50000;
}
else if ((Change/20000) >= 1)
{
thun++;
Change = Change - 20000;
}
else if ((Change/10000) >= 1)
{
hun++;
Change = Change - 10000;
}
else if ((Change/5000) >= 1)
{
fty++;
Change = Change - 5000;
}
else if ((Change/2000) >= 1)
{
tty++;
Change = Change - 2000;
}
else if ((Change/1000) >= 1)
{
ten++;
Change = Change - 1000;
}
else if ((Change/500) >= 1)
{
five++;
Change = Change - 500;
}
else if ((Change/100) >= 1)
{
one++;
Change = Change - 100;
}
else if (Change >= 25)
{
tfcent++;
Change = Change - 25;
}
}
printf("The change is PHP%d.%02d in\n%d thousand bills\n%d five hundred bills\n%d two hundred bills\n%d one hundred bills\n%d fifty bills\n%d twenty coins\n%d ten coins\n%d five coins\n%d one coins\n%d twentyfive cent coins", c1, c2, thou, fhun, thun, hun, fty, tty, ten, five, one, tfcent);
// return Change;