J'ai essayer un programme mais il n'est pas encore correct, il ne donne pas le bon résultat mais je ne vois pas pourquoi
Avez vous une idée?
with ada.text_io, ada.integer_text_io;
procedure caractere is
A,B,C: Integer;
ligne : character;
begin
ada.text_io.put("saisir une ligne de texte :");
ada.text_io.get(ligne);
A:=0;
B:=0;
C:=0;
for X in Character'First..Character'Last loop
if Character'Pos('A')<=Character'Pos(X)
and Character'Pos(X)<=Character'Pos('Z') then
A:=A+1;
end if;
if Character'Pos('a')<=Character'Pos(X)
and Character'Pos(X)<=Character'Pos('z') then
B:=B+1;
end if;
if Character'Pos('0')<=Character'Pos(X)
and Character'Pos(X)<=Character'Pos('9') then
C:=C+1;
end if;
end loop;
Ada.Text_Io.Put("nombre de lettres majuscules :"); Ada.integer_Text_Io.Put(A);
Ada.Text_Io.new_line;
Ada.Text_Io.Put("nombre de lettres minuscules :"); Ada.integer_Text_Io.Put(B);
Ada.Text_Io.new_line;
Ada.Text_Io.Put("nombre de chiffres :"); Ada.integer_Text_Io.Put(C);
Ada.Text_Io.new_line;
end;
pour répondre à ta question, c'est bien un TP pour la fac que j'ai à faire.