Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Absolute beginner in need of help

Author
Message
TTT
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location:
Posted: 3rd Mar 2007 11:30
Hi started programming a few days ago and am attempting to teach myself

I am trying to create a program that will solve simple SUVAT mechanics programs

I have written a bit of code that should work but I always get as SYNTAX error when I try and run the code at the point where i use an IF THEN command.

HERE IS THE CODE:

Input \"Which piece of information do you not have nor want to find (type full word)? \", C$
Input \"Which piece of information do you want to find (type full word)? \", A$
IF C$=displacement AND A$=final velocity THEN
input \"what is intial velocity?\", u#
input \"what is the acceleration?\", a#
input \"what is the time taken?\", t#
END IF

v#=u#+a#*t#

PRINT \" The final velocity is ... \"; v#,

END CODE

It doesn\'t work and I don\'t know whats wrong. I tried getting reado f the and command so it was like this

Input \"Which piece of information do you not have nor want to find (type full word)? \", C$
Input \"Which piece of information do you want to find (type full word)? \", A$
IF C$=displacement THEN
input \"what is intial velocity?\", u#
input \"what is the acceleration?\", a#
input \"what is the time taken?\", t#
END IF

v#=u#+a#*t#

PRINT \" The final velocity is ... \"; v#,

BUT IT still doesnt work.

Can someone tell me what is wrong....

Thanks
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 3rd Mar 2007 16:14
There are a lot of errors there

In an If-then statement, it must be 1 line:
If x=1 then blahblah

This, does not work:
If x=1 then
blahblah

If you want it more than one line, don't use 'then'.
This works:
If x=1
blahblah
Endif
(note that if you seperate the 'end' and 'if', then it won't work either)


So, these are what works:
If x=1 then blahblah

If x=1
blahblah
Endif



I also notice that you have 'end code'

That is incorrect. It should only be 'end'


Well, it should wrok if you fix everything

-Mansoor S.

(Formerly Xenocythe)
TTT
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location:
Posted: 3rd Mar 2007 17:43
Thank you v much
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 15th Mar 2007 05:22
TTT - There also is an issue with enclosing text in quotes (""). I have edited your program and run it and it works.



You idiots! You've captured their stunt doubles!

Login to post a reply

Server time is: 2024-09-25 19:16:14
Your offset time is: 2024-09-25 19:16:14