Starting from:

$35

COSC6000 Homework 10 Solved


Develop a template class, ShiftArray that has following features.

 template parameters are data type and size of array. Overload operator [] member function circshift(int n) that circularly shifts the elements in the array by n positions.

n is a int type.

If n is positive, shift elements towards right. If n is negative, shift elements towards left.

For example :  

1 2 3 4 5     Initial array elements 

 

5 1 2 3 4      circshift(1) 

 

1 2 3 4 5      circshift(­1) 

 

4 5 1 2 3      circshift(2)

Use code below to test your class:

 

https://tulane.instructure.com/courses/2165899/assignments/13470336                                                                                                                                                                   1/2

 

output will be:

 

 

https://tulane.instructure.com/courses/2165899/assignments/13470336                                                                                                                                                                   2/2

More products