My code is too exact? Please help.

Jul 13, 2013 at 2:44am
NEVERMIND
Last edited on Jul 13, 2013 at 3:37am
Jul 13, 2013 at 2:55am
I am not going give answers, but I would suggest debugging your program. Try working through your program by hand and check your expected values with your debugging values.
Jul 13, 2013 at 3:44am
Not sure why you deleted your post, Exotath. If you are still looking for an answer, check out stream manipulators.

1
2
3
4
5
6
7
8
9
10
11
12
#include<iostream>
#include <iomanip>
using namespace std;

int main()
{
	cout << fixed << setprecision(2); //this will set your decimal printing to 2 decimal places

	cout << 12.12345;
	cout << '\n' << 424.5754;
	cin.get();
}
Last edited on Jul 13, 2013 at 3:46am
Jul 13, 2013 at 3:48am
Thanks! I just figured that out which is why I said nevermind. Fixed everything!
Jul 13, 2013 at 7:40am
even if you've figured it out, you shouldn't delete your post... it's probably useful for the others who have the same (bug) problem...
Topic archived. No new replies allowed.