[Pure Basic 5.6.2] Time Relativation Calc.., Any Problems

Just starting out? Need help? Post your questions and find answers here.
User avatar
JamieVanCadsand
User
User
Posts: 34
Joined: Sun Jun 24, 2018 12:28 pm
Location: Holland

[Pure Basic 5.6.2] Time Relativation Calc.., Any Problems

Post by JamieVanCadsand »

Hey Programmers...

Just i try to create an time relativation calculator, based on the relativation theorie of 'Albert Einstein'...
So this is my script, written in PB5.6.2, Windows XP:

Code: Select all

;TIME RELATIVATION CALCULATOR - RB5.6.2 - WINDOWS XP




;Global Variables [@Numbers]
Global Speed.f = 0.0
Global Second.f = 1.000
Global Lightspeed.i = 299792458 / Second
Global Time.f = Time - Second / Speed

;Global Variables [@Strings]
Global AskSpeed.s = ""
Global ResultLightspeed.s = ""
Global ResultTime.s = ""

;Open Console
If OpenConsole()
  
  ;Print Information to the new line per/rule
  PrintN("Official Lightspeed: 299792458 Meter / Second ")
  PrintN("Official Seconds / Second: 1.000")
  PrintN("")
  PrintN("Typ 'Stop' to Close Console")
  PrintN("")
  
  
  ;From Numerical to String
  AskSpeed = StrF(Speed)
  ResultLightspeed = Str(Lightspeed)
  ResultTime = StrF(Time)
  
  ;Ask Forever while you typ 'Stop'
  While (AskSpeed = "Stop")
    
    ;Typ the speed your rize to the universe
    Print("How fast will you want rize to the universe?: ")
    AskSpeed = Input()
    
    ;Calculate Numbers and Print to Console
    PrintN("Personal Lightspeed: " + ResultLightspeed)
    PrintN("Personal Seconds / Second: " + ResultTime)
    
    
    ;End loop
  Wend
  
EndIf
If i run this script, the console don't will be opens...

But there is an other problem too...
- The calculations are not realistic... just they calculations results are not all right the same as how it must be
hearth about the result... just please, figure out whats wrong with the calculations and then correct my code
to make the calculations all right same as be hearth...

Thanks for our help, Jamie.
firace
Addict
Addict
Posts: 947
Joined: Wed Nov 09, 2011 8:58 am

Re: [Pure Basic 5.6.2] Time Relativation Calc.., Any Problem

Post by firace »

JamieVanCadsand wrote:

If i run this script, the console don't will be opens...
This is because there is a bug here:

Code: Select all

  While (AskSpeed = "Stop")
Should be:

Code: Select all

  While (AskSpeed <> "Stop")
User avatar
JamieVanCadsand
User
User
Posts: 34
Joined: Sun Jun 24, 2018 12:28 pm
Location: Holland

Re: [Pure Basic 5.6.2] Time Relativation Calc.., Any Problem

Post by JamieVanCadsand »

firace wrote:
JamieVanCadsand wrote:

If i run this script, the console don't will be opens...
This is because there is a bug here:

Code: Select all

  While (AskSpeed = "Stop")
Should be:

Code: Select all

  While (AskSpeed <> "Stop")
Thanks for fix this while loop bug, but i am even an noob with do the just calculations for sciensifical applications...
Now there is an calculation bug too yet... now this result isn't natural throw yet, see here and pleace, try to
help me to correct my code about my calculation bug, thad shows an unrealistic result...

So here my console result, just an calculation bug i get:
Official Lightspeed: 299792458 Meter / Second
Official Seconds / Second: 1.000

Typ 'Stop' to Close Console

How fast will you want rize to the universe?: 2000000000
Personal Lightspeed: 299792448
Personal Seconds / Second: -Infinity
How fast will you want rize to the universe?:
The light speed are not perfect calculated about the personal speed input... the result must be show
how slow the time must be translated thowars the speed number you typ into the input, thad means
for the lightspeed and the seconds they must be calculated to an factor to be slower for the personal
spot they must be calculated from the input value about the speed you type in....

I am totally noob with programming about complex and sciensifical calculations yet... so pleace, help me
and correct my code about the calculations.... so i hope learn about it...

So can you fix the calculation bug i get, thanks for help,
Jamie.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3943
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: [Pure Basic 5.6.2] Time Relativation Calc.., Any Problem

Post by wilbert »

It’s confusing to me what you want.
Your code doesn’t do anything with the input you are asking :?
It’s just displaying some precalculated values.
Whatever you input, the output will always stay the same.
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply