Computer Science Canada

Grouping Names(strings) into Two Categories??

Author:  sarah_xoxo [ Sun Nov 03, 2013 6:21 pm ]
Post subject:  Grouping Names(strings) into Two Categories??

can anyone please help me with this question in turing? I don't understand how to group strings. Any help is appreciated, thanks Smile


1) Write a program to divide a class of students in two groups: those whose last name begin with A to h and those that begin with I to Z. Ask each to enter their last name and then output which group they are in. (10 marks and 4 for documentation)

Author:  Insectoid [ Sun Nov 03, 2013 6:50 pm ]
Post subject:  RE:Grouping Names(strings) into Two Categories??

I notice you don't actually have to store anything, you just need to output the category. This makes it really, really easy. All you do is check the first letter of the name: If it's a to h, output "Group 1". If it's i to z, output "Group 2".

If it helps, you can compare characters to numbers. For example,
code:
if a > 5 then
    put "a > 5"
else
    put "a <= 5"
end if


: