Please help me... Translate from c++ to visual basic

This is a discussion on Please help me... Translate from c++ to visual basic within the C++ Programming forums, part of the General Programming Boards category; can someone help me translate this into visual basic x = (t_x < pi)? : (x - ( sign( x ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    8

    Please help me... Translate from c++ to visual basic

    can someone help me translate this into visual basic

    x = (t_x < pi)? : (x - ( sign( x ) *( 2*pi) ))

    function sign(X)
    just returns a 1 if x is positive and a -1 if it is negitive

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Looks invalid to me, since there's no return value between the ? and :.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    8
    Sorry it should be:
    x = (t_x < pi)? x: (x - ( sign( x ) *( 2*pi) ))

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well without knowing vb, an easier to convert syntax would be:
    Code:
    if ( !(t_x < pi) )
      x = x - sign(x) * (2 * pi);

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    8
    So it would read:

    if t_x not less then pi then x=x-sign(x) *(2*pi)

    Correct??

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Well just did a search for "vb tutorial" on google, and the first site got me enough info to give you this:
    Code:
    If t_x >= pi Then
      x = x - sign(x) * 2 * pi;
    Of course I don't have any way of testing it

  7. #7
    Registered User
    Join Date
    Aug 2004
    Posts
    8
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  2. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  3. <list>
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2002, 03:07 PM
  4. Visual Basic C++
    By gussguss in forum C++ Programming
    Replies: 8
    Last Post: 11-20-2001, 09:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21