Hi, I am trying to use a command setprecision from the <iomanip.h> header.
It works well when i declare the number of decimals to display to the right of the decimal point, however i am attempting to have the user input how many places of precision they want. So far it will only out put about 15 characters on the last output no matter what my input is...
I am new to c++ and any help would be awesome.
Thanks
-Scott
#include <iostream.h>
#include <iomanip.h>
int main()
{
float x,y;
cout << "Enter two float-point number (Example: 2.415 1.312)\n";
cin >> x >> y;
float z=x*y;
cout << z << '\n';
cin.ignore(50, '\n');
cout << "how many digits do you want to display to the right of the decimal point?\n";
char q;
cin >> q;
cin.ignore(50, '\n');
cout << setprecision (q) << z << endl;
system("PAUSE");
return 0;
}