Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
BEGIN
ARRAY cart[10]; ARRAY prices[10]; INTEGER count;
count := 0;
PROCEDURE addItem(item, price);
BEGIN
cart[count] := item; prices[count] := price; count := count + 1;
END addItem;
PROCEDURE removeItem(idx);
BEGIN
INTEGER i;
FOR i := idx STEP 1 UNTIL count-2 DO cart[i] := cart[i+1]; prices[i] := prices[i+1] END;
count := count - 1;
END removeItem;
addItem("Apple",2);
addItem("Banana",3);
removeItem(0);
ENDCoding works best on desktop or with an external keyboard.