• Lenguaje

    C

  • 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
69
70
71
72
73
74
75
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main (void)
{
    int a, b, c, d, tipo_de_boleto;
    float e, f, g, h, ticket_diamante;
    float ticket_general, ticket_oro;
    char tecla_repetir;
    a = 0;
    b = 0;
    c = 0;
    d = 0;
    e = 0;
    f = 0;
    g = 0;
    h = 0;
    printf ("Ingresa el valor de ticket diamante: ");
    scanf ("%f", &ticket_diamante);
    (void) getchar ();
    printf ("Ingresa el valor de ticket general: ");
    scanf ("%f", &ticket_general);
    (void) getchar ();
    printf ("Ingresa el valor de ticket oro: ");
    scanf ("%f", &ticket_oro);
    (void) getchar ();
    do {
        system ("cls");
        printf ("Selecciona el valor de tipo de boleto.\n");
        printf ("\t1.- General\n");
        printf ("\t2.- Oro\n");
        printf ("\t3.- Diamante\n");
        printf ("\t: ");
        do {
            scanf ("%d", &tipo_de_boleto);
            (void) getchar ();
            if (tipo_de_boleto<1||tipo_de_boleto>3)
                printf ("Valor incorrecto. Ingr\202salo nuevamente.: ");
        } while (tipo_de_boleto<1||tipo_de_boleto>3);
        if(tipo_de_boleto==1)
        {
            a=a+1;
            e=e+ticket_general;
        }
        if(tipo_de_boleto==2)
        {
            b=b+1;
            f=f+ticket_oro;
        }
        if(tipo_de_boleto==3)
        {
            b=b+1;
            g=g+ticket_diamante;
        }
        putchar ('\n');
        printf ("\250Deseas repetir el proceso? (S/N): ");
        do {
            tecla_repetir = (char) getch();
        } while (tecla_repetir!='s' && tecla_repetir!='n' && tecla_repetir!='S' && tecla_repetir!='N');
        putchar ('\n');
    } while (tecla_repetir=='s' || tecla_repetir=='S');
    d=a+b+c;
    h=e+f+g;
    printf ("Valor de a: %d\n", a);
    printf ("Valor de b: %d\n", b);
    printf ("Valor de c: %d\n", c);
    printf ("Valor de d: %d\n", d);
    printf ("Valor de e: %f\n", e);
    printf ("Valor de f: %f\n", f);
    printf ("Valor de g: %f\n", g);
    printf ("Valor de h: %f\n", h);
    system ("pause");
    return EXIT_SUCCESS;
}