lundi 12 septembre 2016
    1. Program Occurrence_mot ;
    2. var ch, mot : string;
    3. nb, i, k: integer;
    4. begin
    5. repeat
    6. writeln ('saisir un texte');
    7. readln (ch);
    8. Until length (ch)>20;
    9. writeln ('saisir un mot');
    10. readln (mot);
    11. k:=length (mot); nb:=0; i:=1;
    12. repeat
    13. if (ch[i] = mot[1]) and (mot = copy (ch, i, k)) then
    14. begin
    15. nb:=nb+1;
    16. i:=i+k;
    17. end
    18. else
    19. i:=i+1;
    20. until i>length(ch);
    21. writeln (mot, ' figure dans le texte ', nb, ' fois');
    22. end.

0 commentaires:

Enregistrer un commentaire

Page Facebook

Turbo Pascal 32 bits

Turbo Pascal 64 bits