Hatu Posted January 26, 2012 Report Share Posted January 26, 2012 Has anyone heard of Turbo Delphi? It's the programming language that my school required us to use while doing AS computing, and it's kinda stuck with me. Has anyone here used this language? Anyway, part of the program I'm making involves the user entering a number, which I'll call "A" for the sake of this thread. In my code, I'm trying to do 1.5^(a-1), however the language does not allow this. Can anyone provide any logical suggestions that would provide the same result? Sorry for the off-topic randomness Quote Link to comment Share on other sites More sharing options...
Kyp [LDEV] Posted January 26, 2012 Report Share Posted January 26, 2012 Hell, last time I saw Delphi it hardly seemed to let you even write code; however, here you go: [url="http://delphi.about.com/od/beginners/a/delphicourse.htm"]http://delphi.about.com/od/beginners/a/delphicourse.htm[/url] Best i can fathom, I hardly understand the source itself because i'm not very familiar with it. Perhaps some of the snippets contained in this tutorial can put you on the right path? Quote Link to comment Share on other sites More sharing options...
vessellaj Posted January 26, 2012 Report Share Posted January 26, 2012 [quote name='Hatu' timestamp='1327545028' post='52311'] In my code, I'm trying to do 1.5^(a-1), however the language does not allow this. Can anyone provide any logical suggestions that would provide the same result? [/quote] I don't know anything about Delphi specifically, but the following is mathematically equivalent: b assigned (1.5^a)/1.5 Or if the limitation is one mathematical operation per assignment: b assigned 1.5^a b assigned b/1.5 Quote Link to comment Share on other sites More sharing options...
C Del[IS] Posted January 26, 2012 Report Share Posted January 26, 2012 Lots of languages do not support the exponent operator ^. I would look for a function to do this for you. In C++ I think it's something like pow(x,y); where the result is x^y. It also depends on whether we're talking about Win32 delphi or .NET delphi, but there appears to be an example of how to do it for Win32 here: [url="http://www.festra.com/wwwboard/messages/2170.html"]http://www.festra.com/wwwboard/messages/2170.html[/url] Quote Link to comment Share on other sites More sharing options...
Tienbau Posted January 26, 2012 Report Share Posted January 26, 2012 good luck with that! when I had to use a visual delphi thing at Uni I thought it was very appropriately named... After the Delphic Oracle, who produced random results after dosing up on random drugs. It was easy to get it to do the thing it was designed for but I seem to remember we just couldn't get it to do specific things we wanted. Hey maybe it becomes easier to code in if you're drunk or on mushrooms ? 2 Quote Link to comment Share on other sites More sharing options...
Zackman [LDEV] Posted January 26, 2012 Report Share Posted January 26, 2012 Delphi is object orientated turbo-pascal within a VERY mighty IDE. Thats the whole story already:) The language/sytax is c++ like at a few points and you can do very nice software with it. The compiler is originally Borland which is one of the fastest compilers in the world, which is producing very optimized and fast executables. Quote Link to comment Share on other sites More sharing options...
DaveOMac Posted January 26, 2012 Report Share Posted January 26, 2012 res := Power([color=#282828][font=helvetica, arial, sans-serif]1.5[/font][/color], (a-1)); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.