Program S3;
Var
ch,res : string;
//************************************
Function test(ch:String) : boolean;
Var
j : integer;
verif : boolean;
Begin
j := 1;
verif := true;
While verif And (j<=length(ch)) Do
Begin
If (ch[j] In ['A'..'Z','a'..'z'] ) And (length(ch) In [1..50] )
Then
j := j+1
Else verif := false;
End;
test := verif;
End;
//************************************
Procedure remplire(Var ch:String);
Var
i : integer;
Begin
Repeat
write('donner la chaine : ');
readln(ch);
Until (test(ch));
End;
//************************************
Procedure former(Var res:String;ch:String);
Var
i : integer;
conmaj,conmin,voymaj,voymin : string;
Begin
res := '';
conmaj := '';
conmin := '';
voymaj := '';
voymin := '';
For i:=1 To length(ch) Do
Begin
If (ch[i] In ['A'..'Z']) Then
Begin
If (ch[i] In ['A','E','U','O','I','Y']) Then
voymaj := voymaj+ch[i]
Else
conmaj := conmaj+ch[i];
End;
If (ch[i] In ['a'..'z']) Then
Begin
If (ch[i] In ['a','e','u','o','i','y']) Then
voymin := voymin+ch[i]
Else
conmin := conmin+ch[i];
End;
End;
res := conmaj+voymaj+conmin+voymin;
End;
//************************************
Procedure affiche(x:String);
Begin
writeln('La chaine RES est: ',x);
End;
//************************************
Begin
remplire(ch);
former(res,ch);
affiche(res);
End.
Inscription à :
Publier les commentaires (Atom)