C/Visual C - Error en una parrte del codigo

 
Vista:

Error en una parrte del codigo

Publicado por BUG EN EL CODIGO (1 intervención) el 06/04/2022 04:06:13
Me da un error en el codigo siempre que lo intento correr como lo puedo corregir, me sale que necesito abrir un corchete en la linea 65
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
#include <cs50.h>
#include <stdio.h>
 
int get_cents(void);
int calculate_quarters(int cents);
int calculate_dimes(int cents);
int calculate_nickels(int cents);
int calculate_pennies(int cents);
 
int main(void)
{
    // Ask how many cents the customer is owed
    int cents = get_cents();
 
    // Calculate the number of quarters to give the customer
    int quarters = calculate_quarters(cents);
    cents = cents - quarters * 25;
 
    // Calculate the number of dimes to give the customer
    int dimes = calculate_dimes(cents);
    cents = cents - dimes * 10;
 
    // Calculate the number of nickels to give the customer
    int nickels = calculate_nickels(cents);
    cents = cents - nickels * 5;
 
    // Calculate the number of pennies to give the customer
    int pennies = calculate_pennies(cents);
    cents = cents - pennies * 1;
 
    // Sum coins
    int coins = quarters + dimes + nickels + pennies;
 
    // Print total number of coins to give the customer
    printf("%i\n", coins);
}
 
int get_cents(void)
{
    int cents;
    do
    {
        cents = get_int("Number of cents: ");
    }
    while(cents < 0);
    return cents;
}
 
int calculate_quarters(int cents)
{
    int counter_quarters = 0;
    if(cents >= 25)
    {
        counter_quarters ++;
        cents = cents - 25;
    }
    else;
    {
        return counter_quarters;
    }
}
 
 
int calculate_dimes(int cents);
{
    int counter_dimes = 0;
    if (cents > 9 & cents < 25)
    {
        counter_dimes ++;
        cents = cents - 10;
    }
    else
        return counter_dimes
}
 
int calculate_nickels(int cents)
{
    int counter_nickels = 0;
    if(cents > 4 & cents < 10)
    {
        counter_nickels ++;
        cents = cents - 5;
    }
    else
    {
        return counter_nickels;
    }
}
 
int calculate_pennies(int cents)
{
    int counter_pennies = 0;
    if(cents > -1 & cents < 5)
    {
        counter_pennies ++;
        cents = cents - 1;
    }
    else
    {
        return counter_pennies;
    }
}

cash.c:65:1: error: expected identifier or '('
{
^
1 error generated.
make: *** [<builtin>: cash] Error 1


este es el tipo de error que me sale
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
sin imagen de perfil
Val: 265
Bronce
Ha mantenido su posición en C/Visual C (en relación al último mes)
Gráfica de C/Visual C

Error en una parrte del codigo

Publicado por dario (82 intervenciones) el 06/04/2022 09:45:11
Borra el ; de la linea 64
Salu2.
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