Quantcast
Viewing latest article 17
Browse Latest Browse All 40

Answer by Zan Lynx for How to cout int like a double

You are supposed to do it with the locale library.

Mostly copied from https://en.cppreference.com/w/cpp/io/manip/put_money like so:

#include <iomanip>#include <iostream>#include <locale>int main() {  long double val = 239.9;  std::cout.imbue(std::locale("en_US.UTF-8"));  std::cout << std::showbase<< "en_US: " << std::put_money(val)<< std::endl;  return 0;}

Viewing latest article 17
Browse Latest Browse All 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>