2.what will be the output ? Float var=3.278965 Cout<<setprecision(2); Cout<<var a)3.27 b)3.2 c)3.278965 d)3 code example
Example: set precision in c++
// setprecision example
#include <iostream> // std::cout, std::fixed
#include <iomanip> // std::setprecision
int main () {
double f =3.14159;
std::cout << std::setprecision(5) << f << '\n';
std::cout << std::setprecision(9) << f << '\n';
std::cout << std::fixed;
std::cout << std::setprecision(5) << f << '\n';
std::cout << std::setprecision(9) << f << '\n';
return 0;
}