At 08:22 PM 7/14/2012, Kenny Emond wrote:
>   I'm not sure if I can post this here, but I seem to have hit a 
> small roadblock (but I don't know where it is). My main goal is to 
> have an easily accessible meter and feet converter. When I use 
> FBide to compile and run, it comes up with no errors. But when it 
> runs, I put in "a" or "b" and then it just quits (of course, after 
> I press "enter"). Could anyone help me out? Here's what my file looks like:

Well, not a FreeDOS problem at all, but "basic" (mis)understanding of 
programming (not to mention that the math is simply wrong)

>            dim ft as single, m as single, answer1 as single, 
> answer2 as single, input1 as string, a as string, b as string
>            input "Convert (A) Feet to meters, or (B) Meters to 
> feet? [NOTE- Use lower case!] ", input1
>            cls
>            if input1 = a Then

That's where soft matter hits a fast rotating object: You input a 
string but compare the input against an uninitialized variable called 
a. The proper comparison would be 'if input1 = "a" then', as string 
constants have to be enclosed in double quotes

>               input "Feet amount: ", ft
>               answer1 = ft * 3.2808399

Don't know where you got that number from but a foot in the commonly 
accepted Fred Flintstone units is 0.3048m (1 foot = 12 inches of 
25.4mm each, that's 304.8mm = 0.3048m)

>               cls
>               print ; ft; " feet is equal to "; answer1; " meters."
>               sleep
>            elseif input1 = b then

Same as above, to compare strings, you need to enclose the string 
constant in double quotes, so it needs to be 'elseif input1 = "b" 
then', or else you again compare against an uninitialized variable named b

>               input "Meter amount: ", m
>               answer2 = m / 3.2808399

Again wrong math, in order to get from meters you need to divide by 
0.3048 (or multiply by 3.28084)

>               cls
>               print ; m; " meters is equal to "; answer2; " feet."
>               sleep
>            end if
>            sleep
>            end
>Any ideas?

See above. It would be really helpful for you if you hit the books 
about BASIC (almost any one will do) to understand the differences 
between the different data types and how to use them.


Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
Freedos-user mailing list

Reply via email to