Bills and coin denomination program I am currently in an intro C++ programming class. We have an assignment where we have to convert a dollar and cents amount, say $192.89, to bills and coins using the least amount of both. Below is the program I have written.

#include &lt;iostream&gt;

using std::cout;
using std::cin;
using std::endl;

int main()
{
    double TotalAmount;
    int DollarsConversion;
    int Change;     
    int Dollars;     
    int Hundreds = 0;
    int Fifties = 0;
    int Twenties = 0;
    int Tens = 0;
    int Fives = 0;
    int Ones = 0;
    int CentsConversion;    
    int Cents;
    int Quarters = 0;
    int Dimes = 0;
    int Nickels = 0;
    int Pennies = 0;

    cout &lt;&lt; "Please enter the amount to convert: $";
    cin &gt;&gt; TotalAmount;

    //Dollars Calculation.
    DollarsConversion = TotalAmount * 100;
    Hundreds = DollarsConversion / 10000;
    Change = DollarsConversion % 10000;
    Fifties = Change / 5000;
    Change %= 5000;
    Twenties = Change / 2000;
    Change %= 2000;
    Tens = Change / 1000;
    Change %= 1000;
    Fives = Change / 500;
    Change %= 500;
    Ones = Change / 100;
    Change %= 100;

    //Resets the Stack to calculate for the cents.
    Dollars = TotalAmount;   
    CentsConversion = TotalAmount * 1000;   
    Dollars *= 1000;    
    Cents = CentsConversion - Dollars;

    //Cents Calculation.
    Quarters = Cents / 250;
    Change = Cents % 250;
    Dimes = Change / 100;
    Change %= 100;
    Nickels = Change / 50;
    Change %= 50;
    Pennies = Change / 10;
    Change %= 10;

    cout &lt;&lt; "\nNumber of Hundred Dollar Bills: " &lt;&lt; Hundreds &lt;&lt; endl;
    cout &lt;&lt; "Number of Fifty Dollar Bills: " &lt;&lt; Fifties &lt;&lt; endl;
    cout &lt;&lt; "Number of Twenty Dollar Bills: " &lt;&lt; Twenties &lt;&lt; endl;
    cout &lt;&lt; "Number of Ten Dollar Bills: " &lt;&lt; Tens &lt;&lt; endl;
    cout &lt;&lt; "Number of Five Dollar Bills: " &lt;&lt; Fives &lt;&lt; endl;
    cout &lt;&lt; "Number of One Dollar Bills: " &lt;&lt; Ones &lt;&lt; endl;

    cout &lt;&lt; "\nNumber of Quarters: " &lt;&lt; Quarters &lt;&lt; endl;
    cout &lt;&lt; "Number of Dimes: " &lt;&lt; Dimes &lt;&lt; endl;
    cout &lt;&lt; "Number of Nickels: " &lt;&lt; Nickels &lt;&lt; endl;
    cout &lt;&lt; "Number of Pennies: " &lt;&lt; Pennies &lt;&lt; endl;

    return 0;
}
You have a lot of copy-and-paste code, where the only things that vary are the variable name, denomination, and textual description.  You can generalize the logic.

#include &lt;iostream&gt;

struct Denomination {
    const int cents;
    const char *description;
};

const Denomination DENOMINATIONS[] = {
    { 10000, "Hundred-Dollar Bills" },
    {  5000, "Fifty-Dollar Bills" },
    {  2000, "Twenty-Dollar Bills" },
    {  1000, "Ten-Dollar Bills" },
    {   500, "Five-Dollar Bills" },
    {   100, "One-Dollar Bills" },
    {    25, "Quarters" },
    {    10, "Dimes" },
    {     5, "Nickels" },
    {     1, "Pennies" }
};

int main() {
    double totalAmount;
    std::cout &lt;&lt; "Please enter the amount to convert: $";
    std::cin &gt;&gt; totalAmount;
    std::cout &lt;&lt; '\n';

    int cents = 100 * totalAmount;
    for (int i = 0; i &lt; sizeof(DENOMINATIONS) / sizeof(DENOMINATIONS[0]); ++i) {
        std::cout &lt;&lt; "Number of " &lt;&lt; DENOMINATIONS[i].description
                  &lt;&lt; ": " &lt;&lt; (cents / DENOMINATIONS[i].cents) &lt;&lt; '\n';
        cents %= DENOMINATIONS[i].cents;
    }
}


Also note:


A somewhat common convention is to use this NamingConvention for types, this namingConvention for variable names, and this NAMING_CONVENTION for constants.
Your DollarsConversion variable is misnamed, in my opinion, as it actually stores the number of cents.