Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Array{
- public:
- int* tab;
- const int size_of_tab;
- Array(int size_tab);
- ~Array();
- int get(int index){
- if((index>size_of_tab)||(index<0)) cout<<"Niepoprawny numer indexu!"<<endl;
- else return tab[index];
- }
- void set(int index, int newValue){
- tab[index]=newValue;
- }
- int* front(){
- return tab;
- }
- int* back(){
- return &tab[size_of_tab];
- }
- int size(){
- return size_of_tab;
- }
- void fill(int value)
- {
- for(int i=0; i<size_of_tab;i++){
- tab[i]=value;
- }
- }
- void assign(const int tab_source[], int tabSize){
- if(tabSize>size_of_tab) tabSize=size_of_tab;
- for(int i=0; i<tabSize; i++){
- tab[i]=tab_source[i];
- }
- }
- };
- Array::Array(int size_tab=20): size_of_tab(size_tab){
- tab=new int(size_tab);
- }
- Array::~Array(){
- delete [] tab;
- }
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment