cmce

8
 Avmunj 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(); }

Transcript of cmce

Page 1: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 1/8

 

Avmunj

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();

}

Page 2: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 2/8

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.601The Boiling point at pressure 3250 = 268.115

Page 3: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 3/8

The Boiling point at pressure 3500 = 270.487

The Boiling point at pressure 3750 = 272.732

The Boiling point at pressure 4000 = 274.867

The Boiling point at pressure 4250 = 276.902

The Boiling point at pressure 4500 = 278.85

The Boiling point at pressure 4750 = 280.717

The Boiling point at pressure 5000 = 282.512

The Boiling point at pressure 5250 = 284.24

The Boiling point at pressure 5500 = 285.908

The Boiling point at pressure 5750 = 287.52

The Boiling point at pressure 6000 = 289.081

The Boiling point at pressure 6250 = 290.594

The Boiling point at pressure 6500 = 292.063

The Boiling point at pressure 6750 = 293.49

The Boiling point at pressure 7000 = 294.879

The Boiling point at pressure 7250 = 296.231The Boiling point at pressure 7500 = 297.55

The Boiling point at pressure 7750 = 298.836

The Boiling point at pressure 8000 = 300.092

The Boiling point at pressure 8250 = 301.32

The Boiling point at pressure 8500 = 302.52

The Boiling point at pressure 8750 = 303.695

The Boiling point at pressure 9000 = 304.846

The Boiling point at pressure 9250 = 305.974

The Boiling point at pressure 9500 = 307.079

The Boiling point at pressure 9750 = 308.164The Boiling point at pressure 10000 = 309.228

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{

Page 4: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 4/8

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);}

Page 5: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 5/8

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<<" Friction factor="<<f<<endl;

}

getch();

}

Output :

Nre=5000 Friction factor=0.000402403Nre=10000 Friction factor=0.000357262

Page 6: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 6/8

Nre=15000 Friction factor=0.000334376

Nre=20000 Friction factor=0.000319479

Nre=25000 Friction factor=0.000308615

Nre=30000 Friction factor=0.000300155

Nre=35000 Friction factor=0.000293277

Nre=40000 Friction factor=0.000287513

Nre=45000 Friction factor=0.000282572

Nre=50000 Friction factor=0.000278262

Nre=55000 Friction factor=0.000274449

Nre=60000 Friction factor=0.000271038

Nre=65000 Friction factor=0.000267957

Nre=70000 Friction factor=0.000265153

Nre=75000 Friction factor=0.000262582

Nre=80000 Friction factor=0.000260211

Nre=85000 Friction factor=0.000258015

Nre=90000 Friction factor=0.000255969Nre=95000 Friction factor=0.000254058

Nre=100000 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);

Page 7: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 7/8

}while(vo!=v);

cout<<p<<" "<<t<<" "<<v<<endl;

}

}

getch();

}

Output :

10 173 1.71904

10 223 2.15877

10 273 2.58861

10 323 3.01307

10 373 3.43419

15 173 1.22671

15 223 1.53004

15 273 1.82389

15 323 2.11248

15 373 2.39775

20 173 0.974824

20 223 1.20974

20 273 1.43558

20 323 1.65633

20 373 1.8738

25 173 0.820224

25 223 1.0139

25 273 1.19886

25 323 1.37889

25 373 1.55572

30 173 0.714869

30 223 0.88088

30 273 1.03851

30 323 1.19136

30 373 1.34108

35 173 0.63801335 223 0.784131

35 273 0.922153

35 323 1.05555

35 373 1.1859

40 173 0.579197

40 223 0.710286

40 273 0.833537

40 323 0.952298

40 373 1.06809

45 173 0.53256145 223 0.651871

Page 8: cmce

8/3/2019 cmce

http://slidepdf.com/reader/full/cmce 8/8

45 273 0.763575

45 323 0.870916

45 373 0.97536

50 173 0.494557

50 223 0.60437

50 273 0.706787

50 323 0.804958

50 373 0.9003