• Lenguaje

    Pascal

  • Descripción

    Se requiere que se identifiquen los datos de entrada, salida y proceso, contextualizado en situaciones que sirvan de apoyo en la labor administrativa del alquiler de una cancha de fútbol.
    A continuación, realizar lo siguiente: Calcular y mostrar por la pantalla del computador el total de personas que ingresan a la cancha de fútbol, en donde, se debe registrar e indicar si es hombre o mujer por el teclado del computador y, luego, al final del día, mostrar el resultado que es el total de hombres y mujeres que ingresaron a la cancha.

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
program AlquilerDeUnaCanchaDeFutbol;
uses crt;

var genero, hombres, mujeres, total_de_personas : integer;
var tecla_repetir : char;
begin
    hombres := 0;
    mujeres := 0;
    total_de_personas := 0;
    repeat
        clrscr;
        writeln ('Selecciona el valor de genero.');
        writeln ('    1.- Mujer');
        writeln ('    2.- Hombre');
        write ('    : ');
        repeat
            readln (genero);
            if (genero<1) or (genero>2) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (genero>=1) and (genero<=2);
        total_de_personas := total_de_personas+1;
        if genero=1 then
            begin
                mujeres := mujeres+1;
            end
        else
            begin
                hombres := hombres+1;
            end;
        writeln;
        write (#168'Deseas repetir el proceso? (S/N): ');
        repeat
            tecla_repetir := readkey;
        until (tecla_repetir = 's') or (tecla_repetir = 'n') or (tecla_repetir = 'S') or (tecla_repetir = 'N');
    until (tecla_repetir <> 's') and (tecla_repetir <> 'S');
    writeln ('Valor de hombres: ', hombres);
    writeln ('Valor de mujeres: ', mujeres);
    writeln ('Valor de total de personas: ', total_de_personas);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.