Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int *tworzenieTablicy(int *t)
- {
- int wczytane;
- int licznik=0;
- int rozmiar=10;
- for(int i=0; i<=rozmiar; i++)
- {
- if(licznik==rozmiar)
- {
- rozmiar=licznik+10;
- int *nowa= new int[licznik];
- for(int l=0; l<licznik; l++)
- {
- nowa[l] = t[l];
- }
- delete [] t;
- t= new int[rozmiar];
- for(int k=0; k<licznik; k++)
- {
- t[k]= nowa[k];
- }
- i=licznik;
- }
- cout<<"podaj liczbe: ";
- cin>>t[i];
- cout<<endl;
- if (t[0]<1||t[0]>100)
- return NULL;
- if (t[i]<1||t[i]>100)
- {
- for(int j=i; j<rozmiar; j++)
- {
- t[j]=0;
- }
- if((licznik)%10==0) {
- return t+(licznik-1);
- }
- else
- {
- return t+rozmiar;
- }
- }
- licznik++;
- }
- }
- int main() {
- int *t=new int[10];
- cout<<tworzenieTablicy(t);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement