Hello everyone I am in need of some help.. I thought that I did my assignment the way that my professor wanted but I just found out that he wants me to solve it differently.

Problem:

Given any amount of money expressed in dollars, and cents, this program computes the number of 100 , 50, 20, 10, 5 and 1 dollar bills and number of quarters, dimes, nickels, and pennies to be returned, returning how many of each denomination are included.

I figured out how to program it correctly for the most part except I cannot figure out how to handle large numbers, such as 14.49999999999999999999999999999999.

When converting that number to int it returns it as 14.50. Does anyone know how to handle converting doubles, similar to the one above, to an integer correctly?

This is the code my teacher did not want because I treated the input as a string. Thanks in advance for your help!

```
#include <iostream>
#include <string>
#include<iomanip>
#include<windows.h>
using namespace std;
int main(){
const int hundredsConst=10000, fiftiesConst=5000, twentiesConst=2000, tensConst=1000;
const int fivesConst=500, onesConst=100, quartersConst=25, dimesConst=10, nickelsConst=5, tab=5;
int hundreds, fifties, twenties, tens, fives, ones, quarters, dimes, nickels, pennies;
int dollarsBeforeDecimal, centsAfterDecimal, moneyInPennies, counter=1;
string name, hundredsEnd, fiftiesEnd, twentiesEnd, tensEnd, fivesEnd, onesEnd, quartersEnd, dimesEnd, nickelsEnd, penniesEnd;
char decimalPoint;
cin >> dollarsBeforeDecimal >> decimalPoint >> centsAfterDecimal;
moneyInPennies = (dollarsBeforeDecimal*100) + (centsAfterDecimal);
hundreds = moneyInPennies/hundredsConst;
moneyInPennies -= hundreds*hundredsConst;
fifties = moneyInPennies/fiftiesConst;
moneyInPennies -= fifties*fiftiesConst;
twenties = moneyInPennies/twentiesConst;
moneyInPennies -= twenties*twentiesConst;
tens = moneyInPennies/tensConst;
moneyInPennies -= tens*tensConst;
fives = moneyInPennies/fivesConst;
moneyInPennies -= fives*fivesConst;
ones = moneyInPennies/onesConst;
moneyInPennies -= ones*onesConst;
quarters = moneyInPennies/quartersConst;
moneyInPennies -= quarters*quartersConst;
dimes = moneyInPennies/dimesConst;
moneyInPennies -= dimes*dimesConst;
nickels = moneyInPennies/nickelsConst;
moneyInPennies -= nickels*nickelsConst;
pennies = moneyInPennies;
return 0;
}
```