![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 20.11.2019 22:31 cwibs
Clanguage i have to modify the given code to repeat the same problem but use only one queue for all the jobs and execute it for 100 iterations and print out the results. #include< stdio. h>
int main()
{
int queuea[100],queueb[100],queuec[100] ,lpa=0,lpb=0,lpc=0,upa=0,upb=0,upc= 0,joba=0,jobb=0,jobc=0,parta=0,part b=0,partc=0,i, j;
for(i=0; i< =100; i++)
{
int n=rand()%200+1; //generates random no between 0 to 200
if(n> =0& & n< =49) //if value of n is between 0 to 49 then executes
{
if(n> =0& & n< =25) //if value of n is between 0 to 25 then executes
{
upa++; //increment upa by 1
queuea[upa]=n; //insert value of n at index upa in queuea
parta=1; //set parta 1
}
else if(n> =26& & n< =39) //if value of n is between 26 to 39 then executes
{
upb++; //increment upb by 1
queueb[upb]=n; //insert value of n at index upb in queueb
partb=1; //set partb 1
}
else if(n> =40& & n< =49) //if value of n is between 40 to 49 then executes
{
upc++; //increment upc by 1
queuec[upc]=n; //insert value of n at index upc in queuec
partc=1; //set partc 1
}
}
else if(n> =50& & n< =100) //if value of n is between 50 to 100 then executes
{
if(n> =50& & n< =75) //if value of n is between 50 to 75 then executes
{
queuea[lpa]=0; //set index lpa in queuea 0
lpa++; //increment lpa by 1
joba++; //increment joba by 1
parta=0; //set parta 0
}
else if(n> =76& & n< =89) //if value of n is between 76 to 89 then executes
{
queueb[lpb]=0; //set index lpb in queueb 0
lpb++; //increment lpb by 1
jobb++; //increment jobb by 1
partb=0; //set partb 0
}
else if(n> =90& & n< =100) //if value of n is between 90 to 100 then executes
{
queuec[lpc]=0; //set index lpc in queuec 0
lpc++; //increment lpc by 1
jobc++; //increment jobc by 1
partc=0; //set partc 0
}
}
if(i%5==0) //if i is divisable by 5 then it executes
{
printf("\n");
printf("\nqueue a current state-");
for(j=lpa; j< =upa; j++)
{
printf("%d\t",queuea[j]); //prints all the value between range lpa to upa in queuea
}
printf("\nqueue b current state-");
for(j=lpb; j< =upb; j++)
{
printf("%d\t",queueb[j]); //prints all the value between range lpb to upb in queueb
}
printf("\nqueue c current state-");
for(j=lpc; j< =upc; j++)
{
printf("%d\t",queuec[j]); //prints all the value between range lpc to upc in queuec
}
if(parta==0) //if value of parta is 0 then display a is empty
printf("\npartion a is empty.");
else
printf("\npartion a is not empty.");
if(partb==0) //if value of partb is 0 then display b is empty
printf("\npartion b is empty.");
else
printf("\npartion b is not empty.");
if(partc==0) //if value of partc is 0 then display c is empty
printf("\npartion c is empty.");
else
printf("\npartion c is not empty.");
printf("\njobs run so far is- %d",joba+jobb+jobc); //display total no of jobs run so far
}
}
return 0;
}
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 23:30, ansonhunter8891
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 05:30, savyblue1724707
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 06:30, QueeeenUknown7437
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
You know the right answer?
Clanguage i have to modify the given code to repeat the same problem but use only one queue for all...
Questions in other subjects:
![Konu](/tpl/images/cats/obshestvoznanie.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/fizika.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/ekonomika.png)
![Konu](/tpl/images/cats/ekonomika.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 28.02.2020 19:27
![Konu](/tpl/images/cats/obshestvoznanie.png)
![Konu](/tpl/images/cats/mat.png)