#include <iostream.h>
int main()
{
double
Temperature,
PressureMeasured,
DewPoint;
// Get Temperature as input from the user
cout << "nPlease enter the current Temperature (Celsius): ";
cin >> Temperature;
// Get PressureMeasured as input from the user
cout << "nPlease enter the current Measured Pressure (hPa): ";
cin >> PressureMeasured;
// Get Dew Point as input from the user
cout << "nPlease enter the current Dew Point (Celsius): ";
cin >> DewPoint;
const double
eso = 6.1078,
c0 = 0.99999683,
c1 = -0.90826951e-2,
c2 = 0.78736169e-4,
c3 = -0.61117958e-6,
c4 = 0.43884187e-8,
c5 = -0.29883885e-10,
c6 = 0.21874425e-12,
c7 = -0.17892321e-14,
c8 = 0.11112018e-16,
c9 = -0.30994571e-19;
// 2. Es = eso*(p**(-8))
//
// Es = Pv when Temperature is at Dew Point
// Es checked against 1958 Smithsonian Meterological Tables,
// Smithsonian Institute, Washington, D.C. for accuracy
double p;
p = c0+(DewPoint*(c1+(DewPoint*(c2+(DewPoint*(c3+(DewPoint*(c4+(DewPoint*(c5+(DewPoint*(c6+(DewPoint*(c7+(DewPoint*(c8+(DewPoint*c9)))))))))))))))));
double
SaturationPressure,
DryAirPressure,
WaterVaporPressure,
Density;
SaturationPressure = eso * pow(p, -8);
WaterVaporPressure = SaturationPressure;
DryAirPressure = PressureMeasured - WaterVaporPressure;
const float
GasConstantDry = 287.05,
GasConstantVapor = 461.495;
// Air Density Calculation
Density = (DryAirPressure*100/(GasConstantDry*(Temperature+273.15))) +
(WaterVaporPressure*100/(GasConstantVapor*(Temperature+273.15)));
cout << "nThe Air Density is " << Density << " kg/m^3.nn";
return 0;
}