Guest User

Untitled

a guest
Apr 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.26 KB | None | 0 0
  1. Algoritmo palavra;
  2. Usar crt;
  3. Variáveis palavra: cadeia de caracteres;
  4.     i, l, caracter, totalVogais, totalConsoantes, totalAlgarismos, totalOutros: inteiro;
  5. Início
  6.      Escrever('Escreva uma palavra: ');
  7.      Ler(palavra);
  8.  
  9.      Para i <- 1 Até Length(palavra) Fazer
  10.      Início
  11.             caracter <- Ord(palavra[i]);
  12.            
  13.             Se (caracter < 0) Então
  14.                 caracter <- 256 + caracter;
  15.                
  16.             Seleccionar caso (caracter)
  17.                 58, 65, 69, 73, 79, 85, 97, 101, 105, 111, 117, 129..134,
  18.             136..154, 160..163, 198..199, 224: totalVogais <- totalVogais + 1;
  19.                
  20.                 66..68, 70..72, 74..78, 80..84, 86..90, 98..100,
  21.             102..104, 106..110, 112..116, 118..122, 128, 135,
  22.             152, 164..165: totalConsoantes <- totalConsoantes + 1;
  23.                
  24.                 48..57: totalAlgarismos <- totalAlgarismos + 1;
  25.                
  26.                 Senão totalOutros <- totalOutros + 1;
  27.             FimSeleccionarCaso;
  28.      FimPara;
  29.  
  30.      Escrever('Numero de caracteres da palavra: ', Length(palavra));
  31.      Escrever('Vogais: ', totalVogais);
  32.      Escrever('Consoantes: ', totalConsoantes);
  33.      Escrever('Algarismos: ', totalAlgarismos);
  34.      Escrever('Outros caracteres: ', totalOutros);
  35.  
  36.      readkey;
  37. Fim.
Add Comment
Please, Sign In to add comment