unit conversion problem!!!

http://www.scribd.com/doc/154330181/2013-c

question 1(b)
how to use if else and infinite loop do the

Let the user choose to enter the data either in empirical or SI(metric) units.

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
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;

int main()
{     

 double concrete_temperature,air_temperature,relative_humidity_in_percent,wind_velocity,evaporation_rate;
	* You should choose to enter the data either in empirical or SI(metric) units.*/

    cout<<"Enter the concrete_temperature(°F):";
	cin>>concrete_temperature;

	cout<<"Enter the air temperature(°F):";
	cin>>air_temperature;

	cout<<"Enter the relative humidity in percent(%):";
	cin>>relative_humidity_in_percent;

	cout<<"Enter the wind velocity(m/s):";
	cin>>wind_velocity;

	
	evaporation_rate = pow(concrete_temperature, 2.5)- (relative_humidity_in_percent/100) * pow(air_temperature, 2.5) * (1+0.40) * pow(10, -6);


//E = pow(Tc, 2.5)- r * pow(Tq, 2.5) * (1+0.40) * pow(10, -6)

//where
//E = evaporation rate( lb/ft2/h),
//Tc = concrete temperature(°F),
//Ta = air temperature(°F),
//r = relative humidity in percent/100 and
//V = wind velocity (mph)

return 0;
	}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int main()
{
  char choice='e';
  while(choice!='x') 
  {
    cout<<"Enter choice (e) empirical (s) SI (x) exit";
    //get parameters
               .......................
    if (choice=='s')
    {  
           //transform to SI
                ......................
    }
    if ((choice=='s')||(choice=='e'))
    {
         //do the calculation
              .......................
    }
    if (!((choice=='s')||(choice=='e')||(choice=='x'))
    {
       cout<<"wrong choice. try again";
    }
  }
}


Note that your wind velocity is in miles per hour, not meters per second as you ask on line 22. Also, it is missing from the formula. On line 26 you are missing some parentheses as well. THOSE ARE VERY IMPORTANT. Instead of pow(10,-6) you should use 1e-6
actually is the formula need to change to S.I. unit.

because the formula stated in question is E = (Tc2.5 – rTa2.5)(1 + 0.4V ) × 10–6 (empirical unit).it stated that.


so what should i do?
Change each quantity separately to SI
degrees F=1.8*degrees C +32
1m/s=2.23694mph
1 lb/ft^2= 4.88242764 kg/m^2
Topic archived. No new replies allowed.