Jump to content

Number Question?


Recommended Posts

Definetly new to programming and working my first one, but learning.

My question is:

How do i get the below to give me a return of .00 at the end of the total balance if all 6 of the $'s are .00's

0000.00 + 000.00, so on. right now i get 0000 as a return instead of 0000.00

this works right 000.01 + 0000.00 = 0000.01

$Total = Number ($wellsfargo+$usbank+$chase+$merrick+$royal+$fedreserve)

Thanks in advance

Link to comment
Share on other sites

  • Developers

$Total = Number ($wellsfargo+$usbank+$chase+$merrick+$royal+$fedreserve)
$FormattedTotal = StringFormat("%.2f",$Total )

:)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This is not the best way but you could do

Global $nums[2]
$nums[0] = 0.00
$nums[1] = 0.00
msgbox(0,'',_Add($nums))
Func _Add($nums)
    Local $ret
    For $i = 0 To UBound($nums, 1) - 1
        $ret = $ret + $nums[$i]
    Next
    If Not StringInStr(String($ret), ".") Then
        $ret = $ret & ".00"
    EndIf
    Return $ret
EndFunc ;==>_Add

Call _Add with an array of numbers.

--too slow... and JdeB's is a lot better >.<

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...