[Freedos-user] ? - ?Not sure? - ?
Hey, 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: 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 input Feet amount: , ft answer1 = ft * 3.2808399 cls print ; ft; feet is equal to ; answer1; meters. sleep elseif input1 = b then input Meter amount: , m answer2 = m / 3.2808399 cls print ; m; meters is equal to ; answer2; feet. sleep end if sleep end Any ideas? - A FreeDOS User -- 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 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] ? - ?Not sure? - ?
On Sat, Jul 14, 2012 at 11:22 PM, Kenny Emond cheeseylem...@gmail.com wrote: dim ft as single, m as single, answer1 as single, answer2 as single, input1 as string, a as string, b as string Might the mixture of singles and strings in your dim statement be the issue? You are defining your results as numbers, but your inputs as strings. Unless there is an implicit typecast done by FB, you are attempting to perform arithmetic on input values you have defined as strings, not numbers. Since you can only perform arithmetic on numbers, I'd expect that to fail. __ Dennis https://plus.google.com/u/0/105128793974319004519 -- 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 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] ? - ?Not sure? - ?
if there's no mistake, input is for numbers, and inkey$ or inkey was for alphanumerics... you'll need to check the book to see what's the input acceptor for alphabetic input... eufdp...@yahoo.com eufdp...@yahoo.com eufdp...@yahoo.com eufdp...@yahoo.com eufdp...@yahoo.com From: dmccunney dennis.mccun...@gmail.com To: freedos-user@lists.sourceforge.net Sent: Saturday, July 14, 2012 11:33 PM Subject: Re: [Freedos-user] ? - ?Not sure? - ? On Sat, Jul 14, 2012 at 11:22 PM, Kenny Emond cheeseylem...@gmail.com wrote: dim ft as single, m as single, answer1 as single, answer2 as single, input1 as string, a as string, b as string Might the mixture of singles and strings in your dim statement be the issue? You are defining your results as numbers, but your inputs as strings. Unless there is an implicit typecast done by FB, you are attempting to perform arithmetic on input values you have defined as strings, not numbers. Since you can only perform arithmetic on numbers, I'd expect that to fail. __ Dennis https://plus.google.com/u/0/105128793974319004519 -- 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 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user -- 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 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] ? - ?Not sure? - ?
At 08:22 PM 7/14/2012, Kenny Emond wrote: Hey, 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. Ralf -- 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 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user