convert integer into proper decimal format

how can i convert integer such as 1000 into 1,000.00 or 3031 into 3,031.00?
thanx.
closed account (Gz64jE8b)
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namespace std;

int main()
{
    int a = 100;
    cout << (double)a / 17;
    system("pause");
    return 0;
    
}


You can use this:
add #include<iomanip>

cout<<fixed<<showpoint<<setprecision(2);
cout<<integer<<endl;

http://recurseit.blogspot.com
Last edited on
Topic archived. No new replies allowed.