Results 1 to 5 of 5
I am dealing with money and I don't want it to show $.1, I'd rather it show $.10
Is there a way to change this in C++?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-09-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 32
Force a floating point to show more 0s
I am dealing with money and I don't want it to show $.1, I'd rather it show $.10
Is there a way to change this in C++?
- 09-09-2010 #2
Sure.
Show us your printing code. cout, printf, ...?Debian GNU/Linux -- You know you want it.
- 09-09-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 32
// b5.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
float late,price;
cout << "Enter the number of days late: ";
cin >> late;
if (late>3) {
price=(.15+(late-3)*.10);
} else {
price=.05*late;
}
cout << "Your late fee is $" << price <<endl;
system ("pause");
return 0;
}
I'm new so yes i8t's simple >_<
- 09-09-2010 #4
Look at this.
C++ Notes: I/O ManipulatorsDebian GNU/Linux -- You know you want it.
- 09-09-2010 #5Just Joined!
- Join Date
- Aug 2010
- Posts
- 32
Thanks a bunch


Reply With Quote
