Hi everybody,
I am an absolute beginner - so far. What I did not find out in studying the manual: How can I INPUT numeric data and how can I PRINT numeric data. The INPUT/PRINT statements so far seem to be only for string data. E.g. I want to:
INPUT number1
INPUT number2
x = number1 + number2
PRINT x
How does this work with purebasic?
Thank you,
Roland
Input/Print
Code: Select all
number1 = Val(InputRequester("First Number", "Please make your input:", "")) ;INPUT number1
number2 = Val(InputRequester("Second Number", "Please make your input:", "")) ;INPUT number2
x = number1 + number2
MessageRequester("Sum",Str(x)) ;PRINT x
Another method involves console output (a text only screen). This method is the one you referred to with Input and Print. Use a method similar to the one I demonstrated to do the conversions betwen numbers and text.
Another method involves a GUI (graphic user interface) using gadgets for input and displaying the results.
I hope this helps.
Disclaimer, typed into the browser without checking for spelling or stupid mistakes
Code: Select all
OpenConsole()
Num1.s = Input()
Num2.s = Input()
x.l = Val(Num1) + Val(Num2)
PrintN(Str(x))
Input() ; give you a chance to see the output before the console screen vanishes
CloseConsole()
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Rolstra,
If you are a complete beginner as you say, I would recommend for you to have a look at a site which has been put up by 1 of the forum users here ( blueznl ) which I think will probably help you a lot.
http://www.xs4all.nl/~bluez/datatalk/purebasic.htm
If you are a complete beginner as you say, I would recommend for you to have a look at a site which has been put up by 1 of the forum users here ( blueznl ) which I think will probably help you a lot.
http://www.xs4all.nl/~bluez/datatalk/purebasic.htm