Advertisement
Guest User

afafa

a guest
Apr 28th, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.37 KB | None | 0 0
  1. program taskThreePointOne;
  2. uses SysUtils;
  3. var
  4.         words: array[1..10] of string;
  5.         camelCase, theWord: string;
  6.         position, wordPointer: integer;
  7.         endOfSentence: boolean;
  8. begin
  9.         position := 1;
  10.         wordPointer := 1;
  11.         endOfSentence := false;
  12.         theWord := '';
  13.  
  14.         writeln('Please enter the Camel Case text: ');
  15.         readln(camelCase);
  16.  
  17.         while NOT endOfSentence do
  18.         begin
  19.             if camelCase[position] = UpperCase(camelCase[position]) then
  20.             begin
  21.                 if NOT (theWord = '') then
  22.                 begin
  23.                     words[wordPointer] := theWord;
  24.                     wordPointer := wordPointer + 1;
  25.                 end;
  26.  
  27.                 theWord := camelCase[position];
  28.             end
  29.             else
  30.             begin
  31.                 theWord := theWord + camelCase[position];
  32.             end;
  33.  
  34.             if (position = length(camelCase)) then
  35.             begin
  36.                 words[wordPointer] := theWord;
  37.                 wordPointer := wordPointer + 1;
  38.                 endOfSentence := true;
  39.             end;
  40.  
  41.             position := position + 1;
  42.         end;
  43.  
  44.         for position := wordPointer to 10 do
  45.                 words[position] := '(Empty)';
  46.  
  47.         for position := 1 to 10 do
  48.                 writeln(words[position]);
  49.  
  50.         readln;
  51. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement