Author |
Message |
mike200015
|
Posted: Thu Feb 24, 2005 10:57 pm Post subject: Realstr help! |
|
|
Im using Font.Draw, and i need to display a string with a decimal and the 2 numbers after the decimal are 0 (1.00), but when it displays it shows "1" not "1.00". How do i make it show the ".00" . This is the code im using to display the real num.
code: |
Font.Draw (realstr (itemPrice (5), 3), 172, maxy - 142, font2, black)
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
ssr
![](http://siruisite.port5.com/ssr.jpg)
|
Posted: Thu Feb 24, 2005 11:06 pm Post subject: (No subject) |
|
|
I donno if this would help
for my program I just did an if statement like
if 5.36 mod 5 > 0.01 then
put "0"
and so on,
if a num mod to the last whole # and still has decimal places, then depends on how many
put a "0"
8) |
|
|
|
|
![](images/spacer.gif) |
mike200015
|
Posted: Thu Feb 24, 2005 11:09 pm Post subject: (No subject) |
|
|
that wouldnt really help me in this program. Thanx anyway tho |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Feb 24, 2005 11:56 pm Post subject: (No subject) |
|
|
something like
Turing: |
var num: real := 123. 45
var word: string := intstr(round(num* 100))
put word (1. .*- 2), ".", word (*- 1.. *)
|
|
|
|
|
|
![](images/spacer.gif) |
mike200015
|
Posted: Fri Feb 25, 2005 2:59 pm Post subject: (No subject) |
|
|
tony wrote:
Turing: |
put word(1..*-2), ".", word(*-1..*)
|
wat does that line mean?
And also im using Font.Draw, so is thr anyway to use that with Font.Draw ![Question Question](images/smiles/icon_question.gif) |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Fri Feb 25, 2005 4:32 pm Post subject: (No subject) |
|
|
the line does what it's suppost to do..
output most of the word, a period and then the last two chraracters of the word.
yes, you can use it with Font.Draw. Just pipe all of the output back into a string variable to be used. |
|
|
|
|
![](images/spacer.gif) |
mike200015
|
Posted: Fri Feb 25, 2005 5:04 pm Post subject: (No subject) |
|
|
kk.. thanx ![Exclamation Exclamation](images/smiles/icon_exclaim.gif) |
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Fri Feb 25, 2005 6:17 pm Post subject: (No subject) |
|
|
tony's method should work just fine. However, you might want to take a look at frealstr. Just set the third parameter to 2 and you're set. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
mike200015
|
|
|
|
![](images/spacer.gif) |
|