Pascal/Turbo Pascal - Ayuda urgente con programa

 
Vista:
sin imagen de perfil

Ayuda urgente con programa

Publicado por Daniel Perez (13 intervenciones) el 03/10/2014 03:21:05
este es el enunciado

Dado un texto introducido por pantalla (tamaño máximo 256 caracteres) se desea que usted realice un programa en pascal que realice lo siguiente:

1) mostrar cantidad de palabras total.
2) mostrar cantidad de palabras con menos de 5 letras.
3) mostrar texto invertido por letra
4) y mostrar el tamaño de cada palabra.

se requiere que se haga con procedimientos y funciones, nada de arreglos, espero por su pronta ayuda la necesito urgente
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ayuda urgente con programa

Publicado por ramon (2158 intervenciones) el 03/10/2014 11:41:27
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{Espero esto sirva}
 
 
program textostring;
  uses
     crt;
  const
     long = 256;
   var
     texto : string;
     cont, palt, palm : integer;
 
   procedure entrada_texto(var tex : string);
   begin
      clrscr;
      write('  Entre Texto : ');
      readln(tex);
   end;
 
   function cuenta_palabras(p : string) : integer;
   var
      palabra : string;
      n : integer;
   begin
      palt := 0;
      n := 1;
      palabra := ' ';
      palm := 0;
      for cont := 1 to ord(p[0]) do
      begin
         if p[cont] <> ' ' then
         begin
           palabra[n] := p[cont];
           palabra[0] := chr(n);
           n := n + 1;
         end
       else
          begin
             if (p[cont + 1] <> ' ') and (n > 1) then
             palt := palt + 1;
             if ord(palabra[0]) <  5 then
             palm := palm + 1;
             n := 1;
             palabra := ' ';
          end;
      end;
       if n > 1 then
       begin
       palt := palt + 1;
       if ord(palabra[0]) < 5 then
       palm := palm + 1;
       end;
       cuenta_palabras := palt;
   end;
 
   procedure invierte_texto(t : string);
   var
     ui : integer;
    begin
    write('  ');
    for ui := ord(t[0]) downto 1 do
    write(t[ui]);
   end;
 
   procedure tamano_palabras(p : string);
   var
      o, b, ct, y : integer;
      pal : string;
    begin
       writeln;
       writeln('   El Tama¤o De Las Palabras Es ');
       writeln;
       b := 1;
       pal := ' ';
       write('  ');
       o := 1;
       for y := 1 to ord(p[0]) do
       begin
           if p[y] <> ' ' then
           begin
             pal[b] := p[y];
             b := b + 1;
           end
        else
           begin
              write('  [',o,']=',b - 1);
              o := o + 1;
              b := 1;
              pal := ' ';
           end;
       end;
         if b > 1 then
         write('  [',o,']=',b - 1);
    end;
 
   begin
      clrscr;
      entrada_texto(texto);
      clrscr;
      writeln('  El Texto Es = ',texto);
      writeln;
      writeln('  Palabras Totales = ',cuenta_palabras(texto));
      writeln;
      writeln('  Palabras Menores De 5 Letras = ',palm);
      writeln;
      writeln('  Texto Invertido');
      writeln;
      invierte_texto(texto);
      writeln;
      tamano_palabras(texto);
      readkey;
   end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar