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

AI Thread 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?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Back
Top