fork(13) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. float num = 3.14159;
  6. cout << fixed;
  7. cout.precision(2);
  8. cout << num << endl;
  9. printf("%.2f", num); //apenas se for usar em C puro, não use em C++
  10. return 0;
  11. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
3.14
3.14