Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename Type>
- Type max2 (Type x, Type y) { return (x<y)?y:x;};
- template <typename T,int n> class Array {
- T *a;
- int size;
- public:
- Array() {a=new T[n]; size=n;};
- void show() {
- for (int i=0;i<size; i++) std::cout << a[i] <<std::endl;
- }
- bool set(T val,int index)
- {
- if ((index<0)||(index>=size)) return false;
- a[index]=val;
- return true;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement