C++ Program for this algorithm
Algorithm
(Traversing a Linear Array)Here LA is a linear array with lower bound LB and upper bound UB.This algorithm traverses LA applying an operation PROCESS to each element of LA.
1.[Initialize counter.]Set K:= LB.
2.Repeat steps 3 and 4 while K<=UB.
3.[visit element]Apply process to LA[K].
4.[incease counter]set K:=K+1.
[End of step 2 loop]
5. Exit