Solved

# Floating Decimal Points

Posted on 2000-03-31

int item number;

float price; float numsold;

float income; float discount;

float saleprice;

My program reads from an input file and output is #sold - price -discount - saleprice - income

my calculations for saleprice returns:

Ex.- 5.0575

setw(2) returns 5.06 which is correct.

When the program calculates income-

saleprice * numsold the program returns:

65.747498

setw(2) = 65.75 which is incorrect.

The correct answer is 65.78

RAM is using (65.747498 * 13)=65.747498

How do I correct this problem w/ floating point decimals?

Am I overlooking something simple?

I have tried everything I know of.

Help!!!!!!! Thanks David A Davis

Nash Community College Rocky Mt NC