GW Basic programming

March 17, 2010 at 13:24:21
Specs: Windows 2000
I need the basic command to convert a negative numeric to a positive and visa versa


See More: GW Basic programming

Report •


#1
March 17, 2010 at 13:30:31
a = a *-1

Learn Math. Any thing times a -1 will switch its sign.


Report •

#2
March 17, 2010 at 14:52:52
.. and to convert a negative number to positive use the ABS function.

Stuart


Report •

#3
November 10, 2010 at 00:52:22
1. Example:-
A = -12345
AA = ABS(A)
Print AA 'Check if it worked
'Result prints
12345

2.
Convert the value to a string.
Value$ = Str$(Value) 'change value to a string
A = Len(Value$) 'Get the length of the string
A$ = Mid$(Value$,2,A) 'Drop the first letter of the string
'blank is positive "-" is negative
Value=Val(A$) ' Convert back to a positive value


Report •

Related Solutions


Ask Question