You are on page 1of 3

PROGRAM CODING:

#includeconio.h~
#includestdio.h~
#includemath.h~

long Iactorial(int);

void main()

Iloat d,l,e,Iin,lam,x,y,dist|12|,pr,d1,z0,tp;
int number,i,ct0,gt0;
long Iactorial1;
clrscr();

printI("\n\t\t $IMULATION OF HANDOFF\n");
Ior(i1;i2;i)

printI("\n Enter time instance to Iind traIIic:");
scanI("d",&number);
Iactorial1Iactorial(number);
printI("\n Enter wavelength:");
scanI("I",&l);
dexp(-l);
epow(l,number);
Iin (d*e)/Iactorial1;
printI("\n Poison distribution Ior traIIic in cell d : I ",i,Iin*100);
}

Ior(i1;i5;i)

printI("\n Enter distance oI userd:",i);
scanI("I",&dist|i|);
}

lam500;
z(4*3.14*12);
tppow(lam/z,2);
printI("\n The threshold power is: I",tp);
Ior(i1;i5;i)

x(4*3.14*dist|i|);
ylam/x;
pry*y;
printI("\n The received power oI userd: I",i,pr);
iI(prtp)

ct;
printI("\nUser d is considered hand oII user\n",i);
getch();
}
else

gt;
printI("\nUserd is not a hand oII user\n",i);
getch();
}
}
printI("\n\n No oI users in hand oII:d",ct);
printI("\n\n No oI users not in handoII:d",gt);
getch();
}
long Iactorial(int n)

int c;
long result 1;
Ior( c 1 ; c n ; c )
result result*c;
return ( result );
}

$AMPLE INPUT AND OUTPUT:

$IMULATION OF HANDOFF

Enter time instance to Iind traIIic:1


Enter wavelength:2
Poison distribution Ior traIIic in cell 1 : 27.067056

Enter time instance to Iind traIIic:1


Enter wavelength:1.5
Poison distribution Ior traIIic in cell 2 : 33.469525

Enter distance oI user1:8


Enter distance oI user2:19
Enter distance oI user3:17
Enter distance oI user4:6
Enter distance oI user5:14

The threshold power is: 11.005207

The received power oI user1: 24.761713


User1 is not a hand oII user

The received power oI user2: 4.389889


User 2 is considered hand oII user

The received power oI user3: 5.483564


User 3 is considered hand oII user

The received power oI user4: 44.020828


User4 is not a hand oII user

The received power oI user5: 8.085459


User 5 is considered hand oII user

No oI users in handoII: 3

No oI users not in handoII: 2

You might also like