1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Program Exo3 ;
Var T : array [1..30] of char;
I, N, Occ : Integer ;
Possible : Boolean ;
Begin
Write ('Entrez le nombre d''element du tableau (<=30) ') ;
readln(N) ;
Possible :=False ;
For i :=1 To N Do
Begin
Write ('Donnez la valeur de l''element ',i,' du tableau ') ;
Readln (T[i]) ;
If T[i]='a' then Possible :=True;
If (T[i]='b') and (Possible=True) then begin
Occ :=Occ+1;
Possible:=False;
end
else If ((T[i]<>'b') and (T[i]<>'a')) and (Possible=True) then
Possible:=false;
end;
write('Le d''apparition de la succession des deux caracteres ''a'' et
''b''est égal à ',Occ) ;
readln;
end. |
Partager