When an aircraft or an automobile is moving through the atmosphere, it must over
ID: 3777720 • Letter: W
Question
When an aircraft or an automobile is moving through the atmosphere, it must overcome a force called drag that works against the motion of the vehicle. The drag force can be expressed as F = 1/2 CD times A times rho times V2 where F is the force (in newtons), CD is the drag coefficient. A is the projected area of the vehicle perpendicular to the velocity vector (in m2), is the density of the gas or fluid through which the body is traveling (kg/m3), and V is the body's velocity. The drag coefficient CD has a complex derivation and is frequently an empirical quantity. Sometimes the drag coefficient has its own dependencies on velocities: For an automobile, the range is from approximately 0.2 (for a very streamlined vehicle) through about 0.5. For simplicity, assume a streamlined passenger vehicle is moving through air at sea level (where rho = 1.23 kg/m3). Write a program that allows a user to input A and CD interactively and calls a function to compute and return the drag force. Your program should call the drag force function repeatedly and display a table showing the drag force for the input shape for a range of velocities from 0 m/s to 40 m/s in increments of 5 m/s.Explanation / Answer
#include<stdio.h>
#define density 1.23 // Density 1.23 kg/m^3
double force(double,double,int);//Function to calculate the force
int main()
{
double drag_coefficient,area;//Defining CD and area
printf("Enter drag_coefficient = ");
scanf("%lf",&drag_coefficient);
printf("Enter area perpendicular to the velocity vector = ");
scanf("%lf",&area);
printf("Drag_Coefficent Area Velocity Force ");
printf("======================================================= ");
int velocity;
for(velocity=0;velocity<=40;velocity=velocity+5)//Calculating the force for velocity from 0 to 40 m/s
{
double f = force(drag_coefficient,area,velocity);
printf("%lf %lf %d %lf ",drag_coefficient,area,velocity,f);
}
}
double force(double drag_coefficient, double area,int velocity)//Function for calcuting the force
{
double f;
f = 0.5*drag_coefficient*area*density*velocity*velocity;
return f;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.