Click here for important information about Computing.net.

I know You Can Do it like this

set /a answer=%number1% / %number2%

then you get it.

but how to you get it to do points (points= . )

Example : 1.5If You Know How Please Tell Me and Thank You

:D

I hate re-inventing something that's already been done. In this case, probably several times. Basically, "you can't", but you can fudge it by treating the numbers as a string: remove the dot, do the math, then re-insert the dot as per the rules of math which I don't remember. You can search the forum on "decimal division batch" or "decimal calculation batch" etc. and probably dredge up the solutions. Me, I would just use vbscript, which is native to windows and saves about 100 lines of code. Here's a front-end vbscript for doing command-line calcs:

'==========

'Simple commandline calculator, but handy to have around (batch math is feeble)

'(a "front-end" to vbscript "eval".

'To use (example): cscript /nologo calcit.vbs ((172+6)*3) * 2^8/34 mod 4

'or another, demonstrating fractions: 12.7 / .22

'

'Also note it will do hex-to-decimal conversion and hex math, like: calcit &h70 + &hC, or &h70 + 12

'(but the results always rendered in decimal, alas.)

'Will also concatenate numbers using "&".

set con=wscript.stdin

set cout=wscript.stdout

set t=wscript.arguments

if t.count=0 then

aa=0

cout.write ("enter the math: ")

do while len(aa)>0

aa=con.readline

bb=eval(bb & aa)

cout.writeline("cur.ttl: --------")

cout.writeline(bb)

loop

else

dim a(99)

for i=0 to t.count-1

aa=aa&" "&t(i)

next

cout.writeline(eval(aa))

end if

'========= end

Ask Your Question

Weekly Poll

Do you think Intel's new hybrid chips will better compete with Apple/ARM?

Yes (14) | ||

No (14) | ||

I don't know (15) |

Discuss in The Lounge

Poll History