Objective: To gain proficiency using apvector
objects to implement one-dimensional arrays
Write a program that performs the following tasks on a 1-D integer
array of length 8 implemented as an apvector. Each task should be a
separate function. No auxiliary arrays should be used.
size of array: 8
array positions: 0 1 2 3 4 5 6 7
array entries: 23 -10 17 0 0 -30 0 2
What entry? 42
status: not found
another search (y/n)? y
What entry? 17
status: found at position 2
another search (y/n)? n
smallest element first
array positions: 0 1 2 3 4 5 6 7
array entries: -30 -10 17 0 0 23 0 2
how many steps? -2
rotated array
array positions: 0 1 2 3 4 5 6 7
array entries: 17 0 0 23 0 2 -30 -10
rotate again (y/n)? y
how many steps? 10
rotated array
array positions: 0 1 2 3 4 5 6 7
array entries: -30 -10 17 0 0 23 0 2
rotate again (y/n)? n
size of array: 5
array positions: 0 1 2 3 4
array entries: -30 -10 17 23 2
You may obtain shell program (maniplab.cpp
) from your teacher