subject
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
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
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
question
Social Studies, 22.09.2019 04:10
question
French, 22.09.2019 04:10
question
Chemistry, 22.09.2019 04:10