Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Avneesh123
ASSIGNMENT-2
Program-1
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
float ta=30.0, tb=100.0, ts=150.0;
float a=0.036, rm=0.0125, tt, lhs;
float f[10], d[10], n[10];
n[0]=0;
lhs=(ts-tb)/(ts-ta);
for(int i=0;i<10;i++)
{
f[i]=0.692*exp(-5.78*n[i])+0.131*exp(-30.5*n[i])+0.0534*exp(-74.9*n[i])-lhs;
d[i]=-3.9976*exp(-5.78*n[i])-3.9955*exp(-30.5*n[i])-3.99966*exp(-74.9*n[i]);
n[i+1]=n[i]-f[i]/d[i];
}
i=0;
do
{
if(n[i+1]-n[i]<0.001)
{
cout<<"The time is :"<<n[i+1]*rm*rm*3600/a<<"seconds"<<endl;
i=-1;
}
else
i++;
}while(i>=0);
getch();
}
Output:
The time is :1.42489seconds
Program-2
#include<iostream.h>
#include<conio.h>
#include<stdio.h.>
#include<math.h>
void main()
{
float A=2.6606, B=7.1819, b=0.125, tc=369.9,e;
int p;
float t=50.0, to;
for(p=750;p<=10000;p+=250)
{
do
{
to=t;
e=B-exp(-20*((to/tc)-b));
t=(A*tc)/(e-log(p)/2.303);
}while(to!=t);
cout<<"The Boiling point at pressure "<<p<<" = "<<to<<endl;
}
getch();
}
Output:
The Boiling point at pressure 750 = 228.485
The Boiling point at pressure 1000 = 235.309
The Boiling point at pressure 1250 = 240.889
The Boiling point at pressure 1500 = 245.648
The Boiling point at pressure 1750 = 249.822
The Boiling point at pressure 2000 = 253.554
The Boiling point at pressure 2250 = 256.939
The Boiling point at pressure 2500 = 260.045
The Boiling point at pressure 2750 = 262.92
The Boiling point at pressure 3000 = 265.601
The Boiling point at pressure 3250 = 268.115
Program-3
#include<iostream.h>
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
float ts=120,tb=100,ta=20,alpha=0.036,s=0.0125;
float e,a,p,t=0.001,to,eo;
int i=3;
a=pow(3.142,2)/4;
p=alpha/(s*s);
e=(ts-tb)/(ts-ta);
do
{
to=t;
while(i<20)
{
eo=((1/(i*i))*(exp(-(i*i)*a*p*to)));
e=e-eo;
i=i+2;
}
t=(log(e))/(-p*alpha);
}while(to<t);
cout<<"The time of heating ="<<(to*3600)<<" seconds"<<endl;
getch();
}
Output:
The time of heating =698.541 seconds
Program-4
#include<iostream.h>
#include<conio.h>
#include<math.h>
int main()
{
float
Ao=6.87225,Bo=0.097313,Co=508256.0,a=0.9477,b=0.225,c=129000.0,alp=.00607175,gam=
0.022,r=0.08205,p,t,v,vo,e1,e2,e3,e4,e5,e6,e;
cout<<"ENTER PRESSURE(atm):";
cin>>p;
cout<<"\nENTER TEMPERATURE(K):";
cin>>t;
v=r*t/p;
do
{
vo=v;
e1=(((Bo*r*t)-Ao-Co)/(t*t))/(vo*vo);
e2=(b*r*t-a)/(vo*vo*vo);
e3=(a*alp)/pow(vo,6);
e4=c/((pow(vo,4))*(pow(t,2)));
e5=1+(gam/(vo*vo));
e6=exp(-gam/vo);
e=e4/(e5*e6);
v=r*t/(p-e-e1-e2-e3);
}
while(vo!=v);
cout<<"\nMOLAR VOLUME(Lit):"<<v;
getch();
return 0;
}
Output:
ENTER PRESSURE(atm):5
ENTER TEMPERATURE(K):300
MOLAR VOLUME(Lit):4.7279
Program-5
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
float fo,nre,f=0.01,e;
for( nre=5000;nre<=100000;nre+=5000)
{
do
{
fo=f;
e=4.06*log(nre/sqrt(f))-0.6;
f=1/(e*e);
}while(fo!=f);
cout<<"Nre="<<nre<<"
}
getch();
}
Output:
Nre=5000
Nre=10000
Friction factor=0.000402403
Friction factor=0.000357262
Friction factor="<<f<<endl;
Nre=15000
Nre=20000
Nre=25000
Nre=30000
Nre=35000
Nre=40000
Nre=45000
Nre=50000
Nre=55000
Nre=60000
Nre=65000
Nre=70000
Nre=75000
Nre=80000
Nre=85000
Nre=90000
Nre=95000
Nre=100000
Friction factor=0.000334376
Friction factor=0.000319479
Friction factor=0.000308615
Friction factor=0.000300155
Friction factor=0.000293277
Friction factor=0.000287513
Friction factor=0.000282572
Friction factor=0.000278262
Friction factor=0.000274449
Friction factor=0.000271038
Friction factor=0.000267957
Friction factor=0.000265153
Friction factor=0.000262582
Friction factor=0.000260211
Friction factor=0.000258015
Friction factor=0.000255969
Friction factor=0.000254058
Friction factor=0.000252264
Program-6
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
float Ao=1.3012, Bo=0.4611, r=0.08205, a=0.01931, b=-0.011101, c=43400.0;
float vo,e1,e2,e3,e,v,p,t;
cout<<"P
T
Molal Volume"<<endl;
for(p=10;p<=50;p+=5)
{
for(t=173;t<=373;t+=50)
{
v=r*t/p;
do
{
vo=v;
e1=r*t*(1-c/(vo*t*t*t));
e2=vo+(Bo*(1-(b/vo)));
e3=Ao*(1-a/vo);
e=((e1*e2)-e3)/p;
v=sqrt(e);
}while(vo!=v);
cout<<p<<" "<<t<<"
}
}
getch();
}
Output:
10
10
10
10
10
15
15
15
15
15
20
20
20
20
20
25
25
25
25
25
30
30
30
30
30
35
35
35
35
35
40
40
40
40
40
45
45
173
223
273
323
373
173
223
273
323
373
173
223
273
323
373
173
223
273
323
373
173
223
273
323
373
173
223
273
323
373
173
223
273
323
373
173
223
1.71904
2.15877
2.58861
3.01307
3.43419
1.22671
1.53004
1.82389
2.11248
2.39775
0.974824
1.20974
1.43558
1.65633
1.8738
0.820224
1.0139
1.19886
1.37889
1.55572
0.714869
0.88088
1.03851
1.19136
1.34108
0.638013
0.784131
0.922153
1.05555
1.1859
0.579197
0.710286
0.833537
0.952298
1.06809
0.532561
0.651871
"<<v<<endl;
45
45
45
50
50
50
50
50
273
323
373
173
223
273
323
373
0.763575
0.870916
0.97536
0.494557
0.60437
0.706787
0.804958
0.9003