0% found this document useful (0 votes)
28 views2 pages

False: String

1) The document defines a program that reads in an array of strings, each between 2-12 characters long and in uppercase. 2) It contains procedures to input the array, display the array, and identify strings in the array that alternate between increasing and decreasing character codes in a zigzag pattern. 3) The zigzag procedure analyzes each string character by character, tracking the order of character codes, and prints any strings that change between increasing and decreasing character codes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

False: String

1) The document defines a program that reads in an array of strings, each between 2-12 characters long and in uppercase. 2) It contains procedures to input the array, display the array, and identify strings in the array that alternate between increasing and decreasing character codes in a zigzag pattern. 3) The zigzag procedure analyzes each string character by character, tracking the order of character codes, and prints any strings that change between increasing and decreasing character codes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

program EX03;

uses wincrt;
type
tab=array[1..10] of string[13];
var
t:tab;
i,n:integer;
function verif(ch:string):boolean;
var
test:boolean;
j:integer;
begin
j:=0;
repeat
inc(j);
test:= ch[j] in ['A'..'Z'];
until (j=length(ch)) or (test=false);
end;
procedure saisie(var t:tab; var
begin
repeat
writeln('Donner n entre 5 et 10
readln(n);
until n in [5..10];
for i:=1 to n do
repeat
writeln('Donner la chaine ',i,'
readln(t[i]);
until (length(t[i]) in [2..12])
end;

n:integer);

:');

de lettres Maj de longueur entre 2..12 ');


and (verif(t[i]));

procedure Affiche(t:tab;n:integer);
begin
for i:=1 to n do
write(t[i],' | ');
end;
procedure zigzag(t:tab;n:integer);
var
ch:string;
test,testc,testd:boolean;
j:integer;
begin
WRITELN;
writeln('Les mots ZigZag Sont:');
For i:=1 to n do
begin
ch:=t[i];
j:=2;
if ord(ch[j])>ord(ch[j-1]) then
begin
testc:=true;
testd:=false;
end;
if ord(ch[j])<ord(ch[j-1]) then
begin
testc:=false;
testd:=true;
end;
repeat
inc(j);
test:=false;
if (testc) and (ord(CH[j])<ord(ch[j-1])) then
begin

test:=true;
testc:=false;
testd:=true;
end;
if (testd) and (ord(CH[j])>ord(ch[j-1])) then
begin
test:=true;
testc:=true;
testd:=false;
end;
until (test=false) or (j=length(ch));
if (test) then
writeln(t[i]);
end; end;
begin
saisie(t,n);
affiche(t,n);
zigzag(t,n);
end.

You might also like