#include <iomanip>
#include <iostream>
int main()
{
double num1 = 3.12345678;
std::cout << std::fixed << std::showpoint;
std::cout << std::setprecision(2);
std::cout << num1 << std::endl;
return 0;
}
More Related Contents:
- What exactly is nullptr?
- Is #pragma once a safe include guard?
- Which, if any, C++ compilers do tail-recursion optimization?
- Create Random Number Sequence with No Repeats
- printf with std::string?
- Define preprocessor macro through CMake?
- How should I deal with mutexes in movable types in C++?
- How to get std::vector pointer to the raw data?
- Is it possible to program iPhone in C++
- Is right shift undefined behavior if the count is larger than the width of the type?
- C++ How to detect Windows 10
- May I take the address of the one-past-the-end element of an array? [duplicate]
- Using C Libraries for C++ Programs
- Default class inheritance access
- How can I sort a std::map first by value, then by key?
- How to pass a function pointer that points to constructor?
- questions about name mangling in C++
- Can I download the Visual C++ Command Line Compiler without Visual Studio?
- Why is it that we can write outside of bounds in C?
- What does the three dots in the parameter list of a function mean?
- What encoding does std::string.c_str() use?
- What is a ‘thunk’?
- Converting string of 1s and 0s into binary value
- Why cast a pointer to a float into a pointer to a long, then dereference?
- STL analogue in Fortran
- Why can’t redefine type names in class in C++?
- How should one use std::optional?
- Can I use Qt without qmake or Qt Creator?
- Breaking ReadFile() blocking – Named Pipe (Windows API)
- How to test an EXE with Google Test?