sábado, 27 de setembro de 2014

Contador de letras repetidas, Função for





//Contador de letras repetidas, função for
program ContCarcter;
uses crt;
    var
      a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,w,y,z       : integer;
      nome                                                      : string;
      cont                                                      : integer;
      test                                                      : integer;
      test1                                                     : integer;
begin
        write('Digite seu Lindo Nome: ');
     readln(nome);
                  for cont := 1  to length(nome) do
                     case upcase(nome[cont]) of
                     'A' : a:= a + 1;
                     'B' : b:= b + 1;
                     'C' : c:= c + 1;
                     'D' : d:= d + 1;
                     'E' : e:= e + 1;
                     'F' : f:= f + 1;
                     'G' : g:= g + 1;
                     'H' : h:= h + 1;
                     'I' : i:= i + 1;
                     'J' : j:= j + 1;
                     'K' : k:= k + 1;
                     'L' : l:= l + 1;
                     'M' : m:= m + 1;
                     'N' : n:= n + 1;
                     'O' : o:= o + 1;
                     'P' : p:= p + 1;
                     'Q' : q:= q + 1;
                     'R' : r:= r + 1;
                     's' : s:= s + 1;
                     't' : t:= t + 1;
                     'U' : u:= u + 1;
                     'V' : v:= v + 1;
                     'X' : x:= x + 1;
                     'W' : w:= w + 1;
                     'Y' : y:= y + 1;
                     'Z' : z:= z + 1;
                     end;

         writeln(nome, ' possui');
        if (a<>0) then writeln('a = ', a);
        if (b<>0) then writeln('b = ', b);
        if (c<>0) then writeln('c = ', c);
        if (d<>0) then writeln('d = ', d);
        if (e<>0) then writeln('e = ', e);
        if (f<>0) then writeln('f = ', f);
        if (g<>0) then writeln('g = ', g);
        if (h<>0) then writeln('h = ', h);
        if (i<>0) then writeln('i = ', i);
        if (j<>0) then writeln('j = ', j);
        if (k<>0) then writeln('k = ', k);
        if (l<>0) then writeln('l = ', l);
        if (m<>0) then writeln('m = ', m);
        if (n<>0) then writeln('n = ', n);
        if (o<>0) then writeln('o = ', o);
        if (p<>0) then writeln('p = ', p);
        if (q<>0) then writeln('q = ', q);
        if (r<>0) then writeln('r = ', r);
        if (s<>0) then writeln('s = ', s);
        if (t<>0) then writeln('t = ', t);
        if (u<>0) then writeln('u = ', u);
        if (v<>0) then writeln('v = ', v);
        if (x<>0) then writeln('x = ', x);
        if (w<>0) then writeln('w = ', w);
        if (y<>0) then writeln('y = ', y);
        if (z<>0) then writeln('z = ', z);
        writeln();
        writeln();





readkey;
end.

Nenhum comentário:

Postar um comentário

Pascal - Lazarus