Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct punkt
  6. {
  7.     int x;
  8.     int y;
  9.     punkt * nastepny;
  10. };
  11.  
  12. int main()
  13. {
  14.         punkt * podstawa = new punkt;
  15.         podstawa->x = 1;
  16.         podstawa->y = 2;
  17.         podstawa->nastepny = NULL;
  18.         punkt * start = podstawa;
  19.  
  20.         for(int i=2; i<12; i++)
  21.         {
  22.             punkt * nowy = new punkt;
  23.             podstawa->nastepny = nowy;
  24.  
  25.  
  26.             nowy->x = i;
  27.             nowy->y = i+1;
  28.             nowy->nastepny = NULL;
  29.         }
  30.  
  31.     while(start->nastepny)
  32.     {
  33.         cout<<"X: "<<start->x<<endl;
  34.         cout<<"Y: "<<start->y<<endl;
  35.  
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement