Guest User

Untitled

a guest
May 24th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. struct lista
  6. {
  7.     int wartosc;
  8.     lista *nastepna;
  9. };
  10.  
  11. int main()
  12. {
  13.     vector <lista*> przechowalnia(10);
  14.  
  15.         for(int i = 0; i < 10; i++)
  16.         {
  17.             lista *start;
  18.             start = NULL;
  19.             przechowalnia[i] = start;
  20.  
  21.             for(int j = 0; j < 5; j++)
  22.             {
  23.              lista *roboczy;
  24.              roboczy = start;
  25.              roboczy = new lista;
  26.              roboczy->wartosc = i * j;
  27.              roboczy->nastepna = start;
  28.              start = roboczy;
  29.             }
  30.         }
  31.  
  32.         for(int i = 0; i < przechowalnia.size(); i++)
  33.         {
  34.             while(!przechowalnia[i]->nastepna == NULL)
  35.             {
  36.                 cout<<przechowalnia[i]->wartosc;
  37.                 przechowalnia[i] = przechowalnia[i]->nastepna;
  38.             }
  39.             cout<<endl;
  40.         }
  41.  
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment