• Lenguaje

    Pascal

  • Descripción

    Para ingresar a un evento hay tres tipos de boletos o tickets: General, Oro y Diamante, se debe ingresar el valor de cada uno de estos, se requiere conocer:
    a. El número de boletos o tickets vendidos de tipo general.
    b. El número de boletos o tickets vendidos de tipo oro.
    c. El número de boletos o tickets vendidos de tipo diamante.
    d. El total de los boletos o tickets vendidos.
    e. El valor total de los boletos de tipo general vendidos.
    f. El valor total de los boletos de tipo oro vendidos.
    g. El valor total de los boletos de tipo diamantes vendidos.
    h. El valor total de los boletos o tickets vendidos.

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

var a, b, c, d, tipo_de_boleto : integer;
var e, f, g, h, ticket_diamante : real;
var ticket_general, ticket_oro : real;
var tecla_repetir : char;
begin
    a := 0;
    b := 0;
    c := 0;
    d := 0;
    e := 0;
    f := 0;
    g := 0;
    h := 0;
    write ('Ingresa el valor de ticket diamante: ');
    readln (ticket_diamante);
    write ('Ingresa el valor de ticket general: ');
    readln (ticket_general);
    write ('Ingresa el valor de ticket oro: ');
    readln (ticket_oro);
    repeat
        clrscr;
        writeln ('Selecciona el valor de tipo de boleto.');
        writeln ('    1.- General');
        writeln ('    2.- Oro');
        writeln ('    3.- Diamante');
        write ('    : ');
        repeat
            readln (tipo_de_boleto);
            if (tipo_de_boleto<1) or (tipo_de_boleto>3) then
                write ('Valor incorrecto. Ingr'#130'salo nuevamente.: ');
        until (tipo_de_boleto>=1) and (tipo_de_boleto<=3);
        if tipo_de_boleto=1 then
            begin
                a := a+1;
                e := e+ticket_general;
            end;
        if tipo_de_boleto=2 then
            begin
                b := b+1;
                f := f+ticket_oro;
            end;
        if tipo_de_boleto=3 then
            begin
                b := b+1;
                g := g+ticket_diamante;
            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');
    d := a+b+c;
    h := e+f+g;
    writeln ('Valor de a: ', a);
    writeln ('Valor de b: ', b);
    writeln ('Valor de c: ', c);
    writeln ('Valor de d: ', d);
    writeln ('Valor de e: ', e:0:6);
    writeln ('Valor de f: ', f:0:6);
    writeln ('Valor de g: ', g:0:6);
    writeln ('Valor de h: ', h:0:6);
    write ('Presiona una tecla para terminar . . . ');
    readkey;
end.