阅读背景:

如何在结构中打印变量?

来源:互联网 
#include <stdio.h>
#include <math.h>
#define G 9.81

typedef struct
{
    double weight;
    double drag;
    double time;
} USER_INPUT;

double calculateVelocity(USER_INPUT);

int main(int argc, char **argv)
{
    USER_INPUT userInput;
    double velocity;

    printf("Please enter weight, drag and time: ");
    scanf("%lf %lf %lf", &userInput.weight, &userInput.drag, &userInput.time);

    velocity = calculateVelocity(userInput);

    printf("At t = %f , the parachutist with weight %d kg\nand a drag coefficient %8.2f kg/s \n will have a velocity of %8.2f m/s^2", &userInput.time, &userInput.weight, &userInput.drag, velocity);

    return 0;
}

double calculateVelocity(USER_INPUT data)
{
    double velocity;
    // TODO compute velocity
    return velocity;
}
#include <stdio.h>
#include <math.h>
#define G 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: