SHARE
TWEET

Untitled

a guest Mar 26th, 2020 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.     int n,i;
  5.  
  6. void *wypisz(int *T, int n)
  7.     {
  8.         for(i=0;i<n;i++)
  9.         cout<<T[i]<<" ";
  10.     }
  11.  
  12. void *utworz(int *&T, int n)
  13. {
  14.     T=new int[n];
  15.     for (i=0;i<n;i++)
  16.     {
  17.         cout << "Podaj element "<<i+1<<"/"<<n<<endl;
  18.         cin >>T[i];
  19.     }
  20. }
  21.  
  22.  
  23.  
  24. int* dodaj_1(int *T1,int n)
  25. {
  26.    int *T1nowa = new int[n];
  27.    for (i=0;i<n;i++)
  28.    {
  29.        T1nowa[i]=T1[i]+1;
  30.    }
  31.    wypisz(T1nowa,n);
  32.    return T1nowa;
  33. }
  34.  
  35. int main()
  36. {
  37.  
  38.     cout << "Podaj rozmiar tablicy"<<endl;
  39.     cin >>n;
  40. //Zadanie 1
  41.     int *T1 = new int[n];
  42.     utworz(T1,n);
  43.     cout<<"Tablica przed algorytmem:"<<endl;
  44.     wypisz(T1,n);
  45.     cout<<endl<<"Tablica po algorytmie:"<<endl;
  46.     int *T1nowa =dodaj_1(T1,n);
  47.  
  48.  
  49.     return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top