Scroll to see replies
1.
Get crash string
2.
Sort of invert it, so that e.g. "abaccadc" becomes [3, 1, 3, 1] (i.e. first element is number of times 'a' appears, second is the same for 'b', etc.)
3.
Find the maximum of this array (3 in the example)
4.
Loop through the array again: at each index, test if the value = that of the maximum, and print/append to a list/whatever the corresponding character was ('a', 'c')
For var = min to max
' ...
Next
Function IsValid(ByVal input as String) as Boolean
Dim valid as Boolean
valid = true
' FOR EACH character IN input
Dim this_character_valid as Boolean
' Your case statement construct here, or any other method
valid = valid And this_character_valid ' think about why this works
' END FOR
IsValid = valid
End Function
Function GetCrashes() as String
Dim input as String
Do
' Read input using InputBox or whatever
Loop Until IsValid(input)
GetCrashes = input
End Function
max_char := 'z'
FOR i = 1 TO 6
IF counts = max_count THEN
max_char = ' a if i = 1, b if i = 2, etc. - probably using a case statement
END IF
END FOR
Last reply 1 day ago
SQA Higher Physics - Paper 2 - 25th April 2024 [Exam Chat]Last reply 2 days ago
SQA Higher Mathematics - Paper 1 Non-calculator - 13th May 2024 [Exam Chat]Last reply 4 days ago
SQA Nat 5 English - Critical Reading - 7th May 2024 [Exam Chat]Last reply 1 week ago
SQA Higher English - Critical Reading - 9th May 2024 [Exam Chat]Last reply 1 day ago
SQA Higher Physics - Paper 2 - 25th April 2024 [Exam Chat]Last reply 2 days ago
SQA Higher Mathematics - Paper 1 Non-calculator - 13th May 2024 [Exam Chat]Last reply 4 days ago
SQA Nat 5 English - Critical Reading - 7th May 2024 [Exam Chat]Last reply 1 week ago
SQA Higher English - Critical Reading - 9th May 2024 [Exam Chat]