Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vb
Message
From
22/03/2004 07:51:13
 
 
To
22/03/2004 04:54:27
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: Vb
Miscellaneous
Thread ID:
00888435
Message ID:
00888466
Views:
19
>>I want to change this code from vfp to vb(code and form) ,if you can help


Mohammed:

It is good form to ask a new question to ALL, instead of directing to a particular member. Also try to use 'pre' tags around code to make it indented and easier to read. Here's a simple translation (not tested as don't have VB installed). It should give you a start in VB6 (as your message does not mention you wanted VB.Net right?
dim a, b, lnEpsilon, i, p
a = SomeInitialValueGoesHere ' whatever your appropriate values are
b = 0   ' ???
lnEpsilon = 0.0003

for i = 1 to 5
  p = ( a + b ) / 2
  if ( FuncX( a ) * FuncX( b ) < 0.0 ) then
    b = p
  else
    a = p
    if ( abs( b - a ) <= lnEpsilon ) then
      MsgBox(p,vbOK,"Epsilon")
      exit for    ' leaves for loop
    endif
  endif
next

function FuncX( lnArg )
  lnArg = cos( lnArg ) - 2.0 * lnArg ^ 3 - 0.5 
  return FuncX
end function
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform