错误:' calculeVitesse'的冲突类型

时间:2017-10-16 00:31:01

标签: c

为什么我会收到错误:' calculeVitesse'的冲突类型(最后调用函数),当被调用函数double calculeVitesse(struct FUSEE fusees [4],double t,int b)匹配decalred原型? (新来的C,所以忍受我)

#include <stdio.h>
#include <math.h>
#define g 9.81
typedef struct FUSEE
{
    char *nom;
    double u;
    double m0;
    double q;
} FUSEE;
int choisirFusee();
double calculeVitesse(FUSEE, double, int);
void main()
{
    FUSEE fusees[4] =
    {
        {"Fusee 1", 2000.0, 150000.0, 2700.0},
        {"Fusee 2", 1596.0, 300000.0, 5367.0},
        {"Fusee 3", 3267.0, 543135.0, 8900.0},
        {"Fusee 4", 984.0, 5468.0, 89.5}
    };
    int b;
    double t, v;
    printf("%s: u = %g m0 = %g q = %g\n", fusees[0].nom, fusees[0].u, fusees[0].m0, fusees[0].q);
    printf("%s: u = %g m0 = %g q = %g\n", fusees[1].nom, fusees[1].u, fusees[1].m0, fusees[1].q);
    printf("%s: u = %g m0 = %g q = %g\n", fusees[2].nom, fusees[2].u, fusees[2].m0, fusees[2].q);
    printf("%s: u = %g m0 = %g q = %g\n", fusees[3].nom, fusees[3].u, fusees[3].m0, fusees[3].q);
    b = choisirFusee(); /*select fusee*/
    printf("Donnez le temps (s): ");
    scanf("%lf", &t);
    v = calculeVitesse(fusees[4], t, b); /*calculates speed based on data from struct associated to selected fusee and entered time*/
    printf("Fus\202e choisie:\n");
    printf("Nom: %s\n", fusees[b].nom);
    printf("Vitesse du carburant u: %g m/s\n", fusees[b].u);
    printf("Masse initiale m0: %g kg\n", fusees[b].m0);
    printf("D\202bit de consommation du carburant: %gkg/s\n", fusees[b].q);
    printf("Apr\212s %g secondes, la vitesse v de la fus\202e est %g m/s.", t, v);
}
int choisirFusee()
{
double x;
printf("S.V.P. s\202lectionnez une fus\202e (1 \205 4): ");
scanf("%lf", &x);
return (x-1);
}
double calculeVitesse(struct FUSEE fusees[4], double t, int b) /*error found here*/
{
    double r;
    r = fusees[b].m0-(fusees[b].q)*t;
    r = fusees[b].m0/r;
    r = log10(r)/log10(M_E);
    r = (fusees[b].u)*r;
    r = r-(g*t);
    return (r);
}

我在这里不知所措...... 提前致谢

0 个答案:

没有答案