jeudi 8 septembre 2016
    1. Program sablier;
    2. Var esp,ch:string;
    3. (*******************************************)
    4. Procedure affiche_bas(var esp:string;ch:string);
    5. Var ch2:string;
    6. n,i:integer;
    7. Begin
    8. esp:='';
    9. n:=0;
    10. i:=1;
    11. Writeln(ch);
    12. Repeat
    13. esp:=' '+esp;
    14. n:=n+2;
    15. i:=i+1;
    16. ch2:=esp+copy(ch, i, length(ch)-n);
    17. Writeln(ch2);
    18. Until length(copy(ch, i, length(ch)-n))=1;
    19. End;
    20. (******************************************)
    21. Procedure affiche_haut(esp,ch:string);
    22. Var i,n:integer;
    23. ch2:string;
    24. begin
    25. i:=-1;
    26. n:=1;
    27. Repeat
    28. n:=n+2;
    29. i:=i+1;
    30. delete(esp,1,1);
    31. ch2:=esp+copy(ch, length(ch) div 2-i, n);
    32. Writeln(ch2);
    33. Until ch2=ch;
    34. End;
    35. (********************PP***********************)
    36. Begin
    37. Repeat
    38. Writeln('CH = ');
    39. Readln(ch);
    40. Until (ch<>'') and (odd(length(ch)));
    41. affiche_bas(esp,ch);
    42. affiche_haut(esp,ch);
    43. End.

0 commentaires:

Enregistrer un commentaire

Page Facebook

Turbo Pascal 32 bits

Turbo Pascal 64 bits