Pascal/Turbo Pascal - ayuda urgente con ingreso...

 
Vista:

ayuda urgente con ingreso...

Publicado por Ferny (5 intervenciones) el 21/06/2012 00:09:26
amigos programadores tengo un pequeño problema Ocupo ingresar nombres de paises pero estos no beden repetirse esto es lo k tengo hasta el momento.!!

program hulk;
uses crt;
var
nacionalidad: array [1 .. 6] of string [25];
macrodistancia: array [1 .. 6] of real;
distancia: array [1 .. 6] of real;
x, y: integer;

begin
clrscr;
for x:= 1 to 3 do
begin
write ('Pais de origen del ', x,'ø participante: ');
readln (nacionalidad [x]);
while nacionalidad [x] = nacionalidad [x] do
begin
write ('Ingrese un pais diferente: ');
read (nacionalidad [x]);
end
end;
write (nacionalidad [3]);
readkey
end.
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 ingreso...

Publicado por ramon (2158 intervenciones) el 21/06/2012 16:00:16
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
{Esto aria yo}
 
program hulk;
uses
  crt;
 type
    string25 = string[25];
var
nacionalidad : array[1..6] of string25;
macrodistancia : array[1..6] of real;
distancia : array[1..6] of real;
x, y: integer;
 
 
 function esistepais(dato : string25; n : integer) : boolean;
 var
    nc : integer;
 begin
     esistepais := false;
     if n > 1 then
     begin
     for nc := 1 to n - 1 do
     begin
        if nacionalidad[nc] = dato then
        begin
            esistepais := true;
            break;
        end
     else
         begin
            esistepais := false;
         end;
     end;
    end;
 end;
 
begin
clrscr;
for x := 1 to 6 do
begin
    write('Pais de origen del ', x,'§ participante : ');
    readln (nacionalidad[x]);
    if esistepais(nacionalidad[x],x) then
    begin
       clrscr;
       writeln('El Pais ya Existe Entre otro Pulse Una Tecla');
       readkey;
       x := x - 1;
     end
   else
       begin
          writeln;
          write('Entre Macrodistancia Del Pais N§',x,' : ');
          readln(macrodistancia[x]);
          write('Entre Distancia Del Pais N§',x,' : ');
          readln(distancia[x]);
          clrscr;
       end;
   end;
   clrscr;
   writeln('**** Los Datos Entrados Son ****');
   writeln;
   for y := 1 to x do
   writeln('Pais : ',nacionalidad[y],'    Macrodistancia : ',
   macrodistancia[y]:8:2,'   Distancia : ',distancia[y]:8:2);
   writeln;
   writeln('Pulse Una Tecla');
   readkey
  end.
 
{Espero te sirva}
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