Computer Science Canada a = 3 values out of 5 values |
Author: | person [ Mon Jan 31, 2005 12:35 pm ] |
Post subject: | a = 3 values out of 5 values |
i was wandering if ther was a command that does this if (a= 3 out of the 5 values) then |
Author: | Tony [ Mon Jan 31, 2005 12:57 pm ] | ||
Post subject: | |||
![]() |
Author: | person [ Mon Jan 31, 2005 2:26 pm ] |
Post subject: | |
can u elaborate? cuz i dont understand |
Author: | Tony [ Mon Jan 31, 2005 3:11 pm ] | ||
Post subject: | |||
actually what you can do is.. take your 5 values and sort them to be in order. Now for the condition to be true, a would equal to the 3rd and ether 1st or 5th.
|
Author: | md [ Mon Jan 31, 2005 3:13 pm ] | ||||
Post subject: | |||||
in psudo code...
you can also do it without a loop:
|
Author: | person [ Mon Jan 31, 2005 3:20 pm ] |
Post subject: | |
so i have to type that so many times? ![]() ![]() |
Author: | md [ Mon Jan 31, 2005 3:28 pm ] |
Post subject: | |
how do you store cards? There are lots of ways to simplify card functions, depending on how you represent a card. However, I must point out that the code above is fairly simple and short...if you're going to complain about 15 lines then I'm not sure how your going to write any actual programs... |
Author: | 1337_brad [ Mon Jan 31, 2005 6:44 pm ] | ||
Post subject: | Erm.. | ||
What if you save all the cards to an array, and then check the array for 3 cards... D: seems efficiant.
|