[ create a new paste ] login | about

Link: http://codepad.org/3KHLvMYK    [ raw code | output | fork ]

C++, pasted on Jun 11:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <iomanip>

int main() {
    double pi = 3.1415926536;
    
    std::cout << std::setprecision(2) << std::fixed << pi << std::endl;
    std::cout << std::setprecision(2) << std::scientific << pi << std::endl;
    
    return 0;
}


Output:
1
2
3.14
3.14e+00


Create a new paste based on this one


Comments: