Skip to content

Instantly share code, notes, and snippets.

@Neo-Desktop
Created May 8, 2015 18:50
Show Gist options
  • Save Neo-Desktop/2365591b5b4118279547 to your computer and use it in GitHub Desktop.
Save Neo-Desktop/2365591b5b4118279547 to your computer and use it in GitHub Desktop.
C++ set precision and printf example
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <float.h>
using namespace std;
int main()
{
printf("%.*f\n", FLT_DIG, 3.141592653589);
cout << std::setprecision(FLT_DIG + 10) << 3.141592653589 << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment