C/C++ C++ program for give equations and error rectifier give program.

Click For Summary
The discussion revolves around a C++ program that calculates the expected waiting time (EWQ) in a queuing system using parameters such as arrival rate (LAM), service rate (MU), and the number of servers (N). The program includes a factorial function and iterates through various values of LAM to compute the traffic intensity (RO) and the expected waiting time. Key points include the use of mathematical functions for calculations, the significance of the parameters in queuing theory, and the implementation of loops for iterative calculations. The program also highlights the importance of proper function definitions and variable initialization in C++.
Anantharaman
Messages
2
Reaction score
0
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
int n,fact();
float LAM, MU=3, RO, C=0.1, N=10, F1=0, EXX, EWQ;
clrscr();
for (LAM=0.1;LAM<=1.1;LAM=LAM+0.1)
{
RO=LAM/MU;
EXX=2/(MU*MU);
for(n=1;n<N-1;n=n+1)
F1=F1+(N-n)*pow(LAM*C,n-1)*exp(-LAM*C)/fact(n-1);
EWQ=((N-1)/(2*LAM))+((LAM*EXX)/(2*(1-RO)))-F1;
cout<<"RAO"<<RO<<"EWq"<<EWQ;
}
getch();
}
int fact()
{
int k;
if(k>1)
{
k=k*fact(k-1);
return(k);
}
else
return(1);
}
 
Technology news on Phys.org
Do you have a question?
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 22 ·
Replies
22
Views
3K
Replies
47
Views
5K
Replies
12
Views
2K
Replies
14
Views
3K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 6 ·
Replies
6
Views
12K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
73
Views
6K
  • · Replies 5 ·
Replies
5
Views
3K