home *** CD-ROM | disk | FTP | other *** search
- PROGRAM find_all_lower_case_characters;
-
- CONST string_size = 30;
-
- TYPE low_set = SET OF 'a'..'z';
-
- VAR data_set : low_set;
- storage : STRING[string_size];
- index : 1..string_size;
- print_group : STRING[26];
-
- BEGIN (* main program *)
- data_set := [];
- print_group := '';
- storage := 'This is a SET test.';
-
- FOR index := 1 TO length(storage) DO
- BEGIN
- IF storage[index] IN ['a'..'z'] THEN
- BEGIN
- IF storage[index] IN data_set THEN
- WRITELN(index:4,' ',storage[index],
- ' is already in the set')
- ELSE
- BEGIN
- data_set := data_set + [storage[index]];
- print_group := print_group + storage[index];
- WRITELN(index:4,' ',storage[index],
- ' added to group, complete group = ',
- print_group);
- END;
- END
- ELSE
- WRITELN(index:4,' ',storage[index],
- ' is not a lower case letter');
- END;
- END. (* of main program *)