Page 1 of 1

How to input numbers

Posted: Wed Mar 29, 2017 1:27 pm
by hessu
I want to write a simpel mathematic program. But I don't know how to Input numbers.
open console()
a$=input()
b$=input()
a=Val(a$)
b=Val(b$)

if I input a$ as 1.5 and b$ as 2

debug a *b

aswer will be 2

min question is : How I can input numeric values

I've programmed in Liberty Basic and no problem with this

:oops: :oops:

Re: How to input numbers

Posted: Wed Mar 29, 2017 1:57 pm
by Kwai chang caine
Hello Hessu, and welcome in the amazing word of PB :D

Because when you use float number you must convert to float too

Code: Select all

OpenConsole()
a$=Input()
b$=Input()
a.f=ValF(a$)
b.f=ValF(b$)
Debug a*b
Furthermore, when you put code, it's better to use

Code: Select all

 /code][/color][/b] tag  :wink:

Re: How to input numbers

Posted: Wed Mar 29, 2017 2:20 pm
by Mindphazer
Use ValF() or ValD() instead of Val()
Val() is used for integers or Quads only

Re: How to input numbers

Posted: Thu Mar 30, 2017 6:14 am
by hessu
Thank you very much

:lol: :P

Re: How to input numbers

Posted: Thu Mar 30, 2017 8:49 am
by Kwai chang caine
For one time, the question is not too complicated, for i can help :wink:
Usually, it's or too hard...or too late :mrgreen:

Too much MASTERS of programming haunt this forum, there is surely a nest hidden somewhere :shock: :lol: :lol:

Again welcome in the powerfull word of PB and his champion team 8)

Image

Re: How to input numbers

Posted: Tue Apr 11, 2017 2:37 pm
by Al_the_dutch
Perhaps this might be usefull too.
http://www.purebasic.fr/english/viewtop ... 13&t=66325

Succes
Al