Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

setprecision

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream> //standard input-output stream
#include <iomanip>  //input_output_manipulation
using namespace std;
int main(int argc, char const *argv[])
{
    float R;
    cin >> R;
    float A = 3.14159 * R * R;
    cout << "A=" << fixed << setprecision(4) << A << endl;
    return 0;
}
// setprecision counts whole number >>>  EX:: 34.1234 is equal setprecision(6)
// When the fixed keyword is used, the argument in the setprecision()
// function specifies the number of decimal places to be printed in the output.
Source by www.beecrowd.com.br #
 
PREVIOUS NEXT
Tagged: #setprecision
ADD COMMENT
Topic
Name
2+5 =