Void function returning doubles w/ decimal

Hello,

I have a structured a program that collects data from the user, then calls void function, this void function then calls 3 different value returning functions.

My question is am i able to get decimals on my output because I can't find a way to do it correctly, i already tried setprecision within the functions as well as in the void function...

right now i get no decimal points in my output, i want to have one decimal point on the first 3 outputs..

Any help would be appreciated


1
2
3
4
5
6
7
8
 #include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ios;


Last edited on
Ho ho ho.

You have a thread about your program: http://www.cplusplus.com/forum/beginner/198336/
You have erased your post there. (That is bad net-behaviour.)

Yes, you had errors there, but it was also writing out the desired data correctly, among the garbage.

Re-add setprecision into appropriate place.
I've tried to add it into the void statement but i still end up with more than desired extra decimal points. Also tried adding setprecision within the value returning functions and cout'ing them but still get the same outcome.
this void function then calls 3 different value returning functions

you mean:
this void function then calls 3 different integer value returning functions

If you want decimal places, use double, not int.
Thank you Chervil, I was finally able to fix my error. I had no idea you could even do that. Totes
Topic archived. No new replies allowed.