BKM Computers
New Member
- Reaction score
- 0
- Location
- Hastings Point NSW Australia
Does anyone know how to read psuedo code? I'm having some trouble converting this psuedo code to javascript. it's just a simple problem called the birthday problem and i have done this problem before but last time done it was in VBScript and i'm not to sure how convert it to javascript.
the main trouble i'm having is in the for loop that is highlighted red. any help with this problem would be much appreciated.

Begin Birthday Problem
Set Count to 0
For Group = 1 to 100
Finding Match in Single Group of Birthdays
If Match is true Then
Add 1 to Count
End If
End For
Output Count”%”
End
Begin Finding Match in Single Group of Birthdays
For Person = 1 to 23
Set Birthdays[Person] to random integer between 1 and 365
End For
Set Match to false
For PersonX = 1 to 22
For PersonY = PersonX + 1 to 23
If Birthdays[PersonX] = Birthdays[PersonY] Then
Set Match to true
End If
End For
End For
Thanks in advance
the main trouble i'm having is in the for loop that is highlighted red. any help with this problem would be much appreciated.
Begin Birthday Problem
Set Count to 0
For Group = 1 to 100
Finding Match in Single Group of Birthdays
If Match is true Then
Add 1 to Count
End If
End For
Output Count”%”
End
Begin Finding Match in Single Group of Birthdays
For Person = 1 to 23
Set Birthdays[Person] to random integer between 1 and 365
End For
Set Match to false
For PersonX = 1 to 22
For PersonY = PersonX + 1 to 23
If Birthdays[PersonX] = Birthdays[PersonY] Then
Set Match to true
End If
End For
End For
Thanks in advance