Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
created by smtuttle at Tue May 4 18:44:35 PDT 2010
--------------------------------------------------*/
#include <iostream>
#include <cmath>
using namespace std;
/*--------------------------------------------------
Contract: precision_play : int double double int -> void
Purpose: expects a desired number of fractional places,
and then two double values and an int, and attempts
returns nothing, but has the side-effect of printing
those double values and the int to the screen, each
on its own line, with the 2 double values displayed
with that many fractional places (but not the int value)
Examples: for:
precision_play(3, 1.6666666, 2.7, 5);
...the following should be printed to the screen:
1.667
2.700
5
for:
precision_play(5, 45.222222222, 13.2, 2);
...the following should be printed to the screen:
45.22222
13.20000
2
--------------------------------------------------*/
void precision_play(int num_fract_places, double dbl_val1, double dbl_val2, int int_val)
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(num_fract_places);
cout << dbl_val1 << endl;
cout << dbl_val2 << endl;
cout << int_val << endl;
}