View Single Post
Old 02-09-2007, 01:41 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,713
redhead is on a distinguished road
Here is your problem:
Code:
  int DOLLARS = 0.0;
  int  QUARTERS = 0.0;
  int  DIMES = 0.0;
  int  NICKELS = 0.0;
  int  PENNIES = 0.0;
...
  QUARTERS = (dollars * 1) /.25 ;
  DIMES = (changeamount - (dollars * 1) - (quarters * .25) / .1 );
  NICKELS = (changeamount  - (dollars * 1) - (quarters* .25) - (dimes* .1) / .05) ;
  PENNIES = (changeamount - (dollars * 1) - (quarters * .25) - (dimes * .1) - (nickels * .05)/.01) ;
...
  cout << "dollars: " << Dollars << endl;
  cout << "quarters: " << Quarters << endl;
  cout << "dimes: " << Dimes << endl;
  cout << "nickels: " << Nickels << endl;
  cout <<  "pennies: " <<Pennies<< endl;
...
First off, you're tryig to store decimal numbers into a type INT, remember for that to be accomplished the container must be of type FLOAT.

Second, when you output the result, you address totaly different variables, remember, the programming language is case sensitive.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote