C++ Code:
#include <iomanip.h>
int main(){
double d_numTest = 3.123456;
cout << setprecision(4) << d_numTest << endl;
return 0;
}
Output:
3.1235
Originally posted by: KnightBreed
setprecision(n) is included in iomanip.h. Use it like so:
C++ Code:
int main(){
double d_numTest = 3.123456;
cout << setprecision(4) << d_numTest << endl;
return 0;
}
Output:
3.1235
You had the right idea. I think all that Java is poisoning your mind.Originally posted by: BigJ2078
Give the man a cookie, thats exactly what I was thinking off, would've known it if I wasn't taking java now instead of brushing up on C++
