Results 1 to 4 of 4

Thread: conditions

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    9

    conditions

    Write a condition to express the following:

    X is strictly between -10 and 10.
    Exactly one of X and Y is greater than 6.
    Both X and Y are positive or both X and Y are negative.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    269

    Re: conditions

    could you please tell more about your case? when will this happen? X and Y should be assigned random values matching this conditiones? or what?

  3. #3
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: conditions

    maybe this could help

    VB Code:
    1. If (x >= -10) And (x <= 10) Then
    2.     'x is between -10 and 10
    3. Else
    4.     'x is not between the 2 values
    5. End If
    6.  
    7. If (x > 6) Or (y > 6) Then
    8.     'one or both x and y > 6
    9. End If
    10.  
    11. If (x >= 0) And (y >= 0) Then
    12.     'both x and y are positive
    13. ElseIf (x <= 0) And (y <= 0) Then
    14.     'both x and y are negative
    15. End If
    16.     'they have different signs
    17. End Sub
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    9

    Re: conditions

    Quote Originally Posted by d3gerald
    maybe this could help

    VB Code:
    1. If (x >= -10) And (x <= 10) Then
    2.     'x is between -10 and 10
    3. Else
    4.     'x is not between the 2 values
    5. End If
    6.  
    7. If (x > 6) Or (y > 6) Then
    8.     'one or both x and y > 6
    9. End If
    10.  
    11. If (x >= 0) And (y >= 0) Then
    12.     'both x and y are positive
    13. ElseIf (x <= 0) And (y <= 0) Then
    14.     'both x and y are negative
    15. End If
    16.     'they have different signs
    17. End Sub
    That is all the information I have on this question. Thanks for your response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width