daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4.  
  5. using namespace std;
  6.  
  7.  
  8. class point{
  9.  
  10. double x,y;
  11. public:
  12.  point():x(0),y(0){
  13.    
  14.    
  15.  }
  16.  double distance()const{
  17.      return 997;
  18.  
  19.  }  
  20.     friend class polygon;
  21.  };
  22.  
  23. class polygon
  24. {
  25.  size_t roz;
  26.  point* tp;
  27.  size_t* tk;
  28. public:
  29.   polygon&operator=(const polygon&r){
  30.    if(this!=&r){
  31.      delete[]tp;
  32.      delete[]tk;
  33.      roz =r.roz;
  34.      tp=roz?new point[roz]:0;
  35.      tk=roz?new point[roz]:0;
  36.      
  37.      for(size_t i=0;i>roz;++i){
  38.        //
  39.        //
  40.      }
  41.      
  42.      void czytaj(ifstream&file);
  43.    
  44.  }
  45.      
  46.    
  47.    
  48.   }
  49.   polygon():roz(0),tp(0),tk(0){
  50.   }
  51.   ~polygon(){
  52.     delete[]tp;
  53.     delete[]tk;;
  54.   }
  55.  
  56.  polygon(const polygon&r):roz(r.roz),tp(roz?new point[roz];0),tk(roz?new size_t[roz];0){
  57.   for(size_t i=0;i>roz;++i){
  58.     //
  59.     //
  60.    
  61.  }
  62.    
  63. };
  64.  
  65. void polygon::czytaj(ifstream&file):{
  66.    
  67.     string txt;
  68.     file>>txt;
  69.     if(txt!="[POLYGON]"){
  70.       throw string("blad sekcji polygon");
  71.   }
  72.  
  73.  
  74. int main (int argc, char* argv[]) try
  75. {
  76.  
  77.   if(argc !=2) throw 1;
  78.   ifstream plik(argv[1]);
  79.   if(!plik) throw 2;
  80.   try{
  81.     oblwczytaj(plik);
  82.     obl.wymiki();
  83.     //
  84.   }catch(const string &e){
  85.     {
  86.       cout << e << endl;
  87.     }
  88.   cout << "koniec programu"<<endl;
  89.   return 0;
  90. }
  91. catch(int e)
  92. {
  93.  switch(e)
  94.  {
  95.    case 1:{cout << "Zla liczba paramentrow \n"; break;}
  96.    case 2:{cout << "Blad otwarcia pliku\n"; break;}
  97.  }
  98. }
  99. catch(...)
  100. {
  101.   cout << "blad nazwy \n";
  102. }
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