仿真通信系统中的阻塞率随单位时间总的平均呼叫到达率变化
源代码在线查看: erlangb.cpp
#include"stdio.h"
FILE *f;
double block(double ld)
{
int c;
double mu,A;
c=10;mu=0.1;
A=ld/mu;
int i,j,k,n;
n=1;
double sum,pp,p00;
sum=0;
for(i=0;i {
pp=1;
n=1;
for(j=i;j>=1;j--)
{
n=n*j;
}
for(k=1;k {
pp=pp*A;
}
p00=pp/n;
sum=sum+p00;
}
double blockpro;
blockpro=p00/sum;
printf("%f ",blockpro);
return blockpro;
}
void main()
{
f=fopen("out.txt","w");
double ld,blockpro;
ld=0.19;
do{
ld=ld+0.01;
blockpro=block(ld);
fprintf(f,"%f ",blockpro);
}while(ld fclose(f);
}