Ravager Posted October 13, 2004 Share Posted October 13, 2004 In this code: void secs(double& seconds, int milliseconds, int& hours, int& minutes) { seconds = (milliseconds / 1000) - (hours * 3600) - (minutes * 60); } void time(int& milliseconds, int &hours, double &seconds, int &minutes) { hrs(hours, milliseconds); mins(minutes, milliseconds, hours); secs(seconds, milliseconds, hours, minutes); } I wish to output seconds as a double with 3 decimal places. I know what setprecision does, I'm just confused with where to put it... Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted October 13, 2004 Share Posted October 13, 2004 It goes in your cout statement right before the variable you're printing. http://www.cplusplus.com/ref/iostream/ioma...tprecision.html Link to comment Share on other sites More sharing options...
Question
Ravager
In this code:
void secs(double& seconds, int milliseconds, int& hours, int& minutes) { seconds = (milliseconds / 1000) - (hours * 3600) - (minutes * 60); } void time(int& milliseconds, int &hours, double &seconds, int &minutes) { hrs(hours, milliseconds); mins(minutes, milliseconds, hours); secs(seconds, milliseconds, hours, minutes); }I wish to output seconds as a double with 3 decimal places. I know what setprecision does, I'm just confused with where to put it...
Link to comment
Share on other sites
1 answer to this question
Recommended Posts