![]() |
small problem
:
#include <stdio.h>What it does is it asks for the cost of something, then gives you the cost after adding tax to it. But something is wrong with my variable "tax". Can anyone help please? |
I don't think it's a problem with tax. When you make total a variable it works fine. My guess is that there is a different way of defining that, but I don't know how.
|
:
#include <stdio.h>I think that does the same thing as what u were trying to do but without the define bit, calling total a flaot instead is this any help? (i found it useful for me even if it didnt help you) :D nez |
yeah thanks man
but now i have to find out about "%2.2lf" but this is my first day of C so blah :p |
It's just going to print two decimal places with that.
|
you could have just put "%lf" in but it wil print a number with 4 decimal places, the 2.2 just tames it a bit:
2.2 prints a number with 2 long to 2 decimal places i.e 10.65 4.3 prints a number with 4 long to 3 decimal places i.e 4512.854 hope this helps :D nez |
Basically, tax needs to equal 0.15, not .15.
|
thanks guys
even though SAMS has a good reputation, i always have questions this forum shuting down would be a nightmare |
| All times are GMT -5. The time now is 12:59 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC