1. Engineering
  2. Computer Science
  3. write a c program for the following loopandloop serialization roundrobin...

Question: write a c program for the following loopandloop serialization roundrobin...

Question details

WRITE A C PROGRAM FOR THE FOLLOWING:

Loop-and-loop serialization (Round-Robin, google)

First implement a circular link-list, meaning that the tail of the chain is pointing to the head

Contains two functions: increase, execute


Each node is a trip

Add:

Increase the itinerary and enter a number of pending instructions in this trip

-------------------------------------------------- -------------------------------------------------- -------------

Typedef struct node{

Int cm,name;

///cm(command) is the number of instructions to be executed, and name is the generation code of the stroke.

Structure node *next;

///next refers to the indicator of the next node

}node;

-------------------------------------------------- -------------------------------------------------- -------------

Exe:

Enter the number of turns to be executed in the chain, and the number of instructions (cm) to be executed in each iteration is reduced by one. If a certain itinerary is executed, the itinerary will not be executed.

Here's an example:

1->add

2->exe

select:1

input val of cm: 1

1->add

2->exe

select:1

input val of cm: 2

1->add

2->exe

select:1

input val of cm: 3

1->add

2->exe

select:1

input val of cm: 4

1->add

2->exe

select:1

input val of cm: 5

1->add

2->exe

select:2

input the num of cycle: 3

------RoundStart-----

no.1 cm:0

no.2 cm:1

no.3 cm:2

no.4 cm:3

no.5 cm:4

------RoundEnd------

------RoundStart-----

no.2 cm:0

no.3 cm:1

no.4 cm:2

no.5 cm:3

------RoundEnd------

------RoundStart-----

no.3 cm:0

no.4 cm:1

no.5 cm:2

------RoundEnd------

1->add

2->exe

select:1

input val of cm: 3

1->add

2->exe

select:1

input val of cm: 4

1->add

2->exe

select:1

input val of cm: 3

1->add

2->exe

select:1

input val of cm: 2

1->add

2->exe

select:1

input val of cm:

5

1->add

2->exe

select:2

input the num of cycle: 3

------RoundStart-----

no.4 cm:0

no.5 cm:1

no.6 cm:2

no.7 cm:3

no.8 cm:2

no.9 cm:1

no.10 cm:4

------RoundEnd------

------RoundStart-----

no.5 cm:0

no.6 cm:1

no.7 cm:2

no.8 cm:1

no.9 cm:0

no.10 cm:3

------RoundEnd------

------RoundStart-----

no.6 cm:0

no.7 cm:1

no.8 cm:0

no.10 cm:2

------RoundEnd------

1->add

2->exe

select:

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution