Advertisement
Oslapas

Untitled

May 13th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <cmath>
  5. using namespace std;
  6. struct xy
  7. {
  8.     int x,y,nr,x1,y1;
  9. };
  10. void skaitymas(xy ma[],int &n)
  11. {
  12.     ifstream fd("test.txt");
  13.     fd>>ma[0].x>>ma[0].y;
  14.     fd>>ma[1].x>>ma[1].y;
  15.     fd>>n;
  16.     for(int i=0;i<n;i++)
  17.     {
  18.         fd>>ma[i].nr;
  19.         for(int j=0;j<ma[i].nr;j++)
  20.         {
  21.             fd>>ma[j].x1;
  22.             //cout<<ma[j].x1<<endl;
  23.         }
  24.     }
  25.  
  26. }
  27. void skaiciavimas(xy ma[],int &n)
  28. {
  29.     for(int i=0;i<n;i++)
  30.     {
  31.  
  32.         for(int j=0;j<ma[i].nr;j++)
  33.         {
  34.             cout<<ma[j].x1<<endl;
  35.         }
  36.     cout<<" "<<endl;
  37.     }
  38.  
  39. }
  40.  
  41. int main()
  42. {
  43.  xy ma[250];int n;
  44.  skaitymas(ma,n);
  45.  skaiciavimas(ma,n);
  46.  return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement