how to input commas into C++ numeric output
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3479485/is-there-a-built-in-function-that-comma-separates-a-number-in-c-c-or-javascr">Is there a built-in function that comma-separates a number in C, C++, or JavaScript?</a><br>
  <a href="http://stackoverflow.com/questions/4728155/how-do-you-set-the-cout-locale-to-insert-commas-as-thousands-separators">How do you set the cout locale to insert commas as thousands separators?</a>  </p>
</blockquote>



<p>How I could input "commas(,)" to my outputs. for example: $16982 but I need it to look like: $16,982. </p>

<p>Here is my code so far:</p>

<pre><code>#include &lt;iostream&gt; // I/O Stream for form
using namespace std; // to prevent redundance of std

int main() // main to form as integer; begins form
{
            double housing, food, clothing, transportation, education, healthcare, vacations; // Declaring variables for code below as doubles so you can hold a bigger number; decimal values


            // List of expense options that you can choose from
            cout &lt;&lt; "                      ----------Yearly Expenses----------"  &lt;&lt; endl; // outputs heading to user "yearly expenses"
            cout &lt;&lt; "                " &lt;&lt; endl; // ends the line and centers the code

            cout &lt;&lt; "                            housing          $" ; // outputs housing to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            education        $" ; // outputs education to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            food             $" ; // outputs food to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            clothing         $" ; // outputs clothing to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            transportation   $" ; // outputs transportation to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            healthcare       $" ; // outputs healthcare to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code

            cout &lt;&lt; "                            vacations        $" ; // outputs vacations to show user what expenses they can choose from 
            cout &lt;&lt; "                " &lt;&lt; endl;  // ends the line and centers the code



            cout &lt;&lt; "\n\n                         *****Enter your expenses*****" &lt;&lt; endl; // outputs heading to user "enter your expenses"


            cout &lt;&lt; "\n                                   housing: $"; // outputs to user "heading" 
            cin &gt;&gt; housing; //

            cout &lt;&lt; "\n                                   education: $"; // outputs to user "education"
            cin &gt;&gt; education;

            cout &lt;&lt; "\n                                   food: $"; // outputs to user "food"
            cin &gt;&gt; food;

            cout &lt;&lt; "\n                                   clothing: $"; // outputs to user "clothing"
            cin &gt;&gt; clothing;

            cout &lt;&lt; "\n                                   transportation: $"; // outputs to user "transportation"
            cin &gt;&gt; transportation;

            cout &lt;&lt; "\n                                   healthcare: $"; // outputs to user "healthcare"
            cin &gt;&gt; healthcare;

            cout &lt;&lt; "\n                                   vacations: $"; // outputs to user "vacations"
            cin &gt;&gt; vacations;



            double total; // Declaring variable to hold all of the expenses variables
            total = (housing + education + food + clothing + transportation + healthcare + vacations); // shows "total" equals all expenses variables added together


            cout &lt;&lt; "\n\n                       &lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;total with 23% tax&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;" &lt;&lt; endl &lt;&lt; endl; // Outputs the heading "total with 23% tax" to user

            total = (total * .23) + total; // total equals total multiplied by the 23% to get the percentage tax on your expense
            cout &lt;&lt; "                                     $" &lt;&lt; total &lt;&lt; endl; // outputs the total to the user with the added 23% tax





            system("pause&gt;nul"); 
            return 0; // returns nothing/0

}
</code></pre>
