#include <iostream>
#include <algorithm>
using namespace std;
struct MojNauczycielToDupek {
int **tablica;
int *rozmiar;
MojNauczycielToDupek() {
tablica = NULL;
rozmiar = NULL;
}
void podlacz(int **tab, int *n) {
tablica = tab;
rozmiar = n;
}
} mojaKlasaJestOK;
void insert()
{
int nowyRozmiar = *mojaKlasaJestOK.rozmiar + 1;
int *nowaTablica = new int[nowyRozmiar];
copy_n(*mojaKlasaJestOK.tablica, *mojaKlasaJestOK.rozmiar, nowaTablica);
*(nowaTablica + *mojaKlasaJestOK.rozmiar) = 1;
int *temp = *mojaKlasaJestOK.tablica;
*mojaKlasaJestOK.tablica = nowaTablica;
*mojaKlasaJestOK.rozmiar = nowyRozmiar;
delete[] temp;
}
void choose()
{
}
void remove()
{
}
void resize()
{
}
int main()
{
int roz;
cout << "Enter a number of cells:";
cin >> roz;
int *tab;
tab = new int[roz];
for (int i=0;i<roz;i++)
{
cin >> tab[i];
}
for (int i=0;i<roz;i++)
{
cout << tab[i] << endl;
}
mojaKlasaJestOK.podlacz(&tab, &roz);
int wybor;
do
{
cout << "1: insert 1 cell to the end" << endl;
cout << "2: choose a cell and insert 1 cell after it" << endl;
cout << "3: remove the first cell" << endl;
cout << "4: resize the table" << endl;
cout << "5: quit" << endl;
cin >> wybor;
cout << "wybor = " << wybor << endl;
} while(wybor!=1 && wybor !=2 && wybor !=3 && wybor !=4 && wybor !=5);
switch (wybor)
{
case 1:
insert();
break;
case 2:
choose();
break;
case 3:
remove();
break;
case 4:
resize();
break;
case 5:
break;
}
cout << "End state: " << endl;
cout << "roz = " << roz << endl;
cout << "tab = " << endl;
for(int i=0; i < roz; i++) {
cout << tab[i] << ", ";
}
cout << endl;
return 0;
}