Dev - C++ - error en funciones den devc

 
Vista:
sin imagen de perfil

error en funciones den devc

Publicado por Antonio (3 intervenciones) el 16/09/2015 23:19:27
alguien pe podria decir cual es el error que contiene mi programa es que no me compila y me aparece error de sintaxis pero no se cual es el error, apreciaria su ayuda porfavor

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
103
104
105
106
107
108
#include <stdio.h>
 
float funcionsuma(float a, b);
float funcionresta(float a, b);
float funcionmultiplicacion(float a, b);
float funciondivicion(float a, b);
 
int main()
{
    float a, b, suma, resta, multiplicacion, divicion;
    int c;
 
    printf("1 Suma\n");
    printf("2 Resta\n");
    printf("3 Multiplicacion\n");
    printf("4 Divicion\n");
    printf("\n");
 
    printf("Introduce el primer numero:\n");
    scanf("%f", &a); fflush (stdin);
    printf("Introduce el segundo numero:\n");
    scanf("%f", &b); fflush (stdin);
    printf("Introduce una operacion (1-4):\n");
    scanf("%d", &c);  fflush (stdin);
 
    printf("\n");
 
    switch (c){
 
              case 1:
 
                   suma=funcionsuma(a, b);
                   printf("Resultado = %.2f", suma);
                   break;
 
              case 2:
 
                   resta=funcionresta(a, b);
                   printf ("Resultado=%.2f", resta);
                   break;
 
              case 3:
 
                   multiplicacion=funcionmultiplicacion(a, b);
                   printf ("Resultado=%.2f", multiplicacion);
                   break;
 
              case 4:
 
                   if (b!=0){
                             divicion=funciondivicion(a, b);
                             printf ("Resultado=%.2f", divicion);
                             }
 
                   else{
                        printf("No se puede dividir entre 0");
                        }
                   break;
 
 
              default:
                      printf("Opcion no valida");
                      }
              printf("\n");
 
              getchar ();
              return 0;
}
 
float funcionsuma(float a, b)
 
{
      float x;
 
      x=a+b;
 
      return x;
}
 
float funcionresta(float a, b)
 
{
      float x;
 
      x=a-b;
 
      return x;
}
 
float funcionmultiplicacion(float a, b)
 
{
      float x;
 
      x=a*b;
 
      return x;
}
 
float funciondivicion(float a, b)
 
{
      float x;
 
      x=a/b;
 
      return x;
}
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: 417
Ha mantenido su posición en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

error en funciones den devc

Publicado por Thanatos (199 intervenciones) el 17/09/2015 05:06:17
Los errores se deben a que no has declarado el parámetro "b" en ninguna de las cuatro funciones, ni en sus definiciones, ni en sus prototipos. El único parámetro que tienes declarado es "a".
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