Guest User

Untitled

a guest
May 7th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. class ObslugaBledow {
  2.     int error;
  3. public:
  4.     ObslugaBledow();
  5.     ObslugaBledow(int);
  6.     void print();
  7. };
  8.  
  9. ObslugaBledow::ObslugaBledow()
  10. {
  11.     error = 0;
  12. }
  13.  
  14. ObslugaBledow::ObslugaBledow(int a)
  15. {
  16.     error = a;
  17. }
  18.  
  19. void ObslugaBledow::print()
  20. {
  21.     if(error == 0)
  22.     {
  23.         cout << "Nie dosc ze sie wyjebalo, to jakis kutas nie ustawil kodu bledu." << endl;
  24.     } else {
  25.         cout << "Jezus Chrystus Nazarenski, wyjebalo sie z kodem bledu " << error << endl;
  26.     }
  27. }
  28.  
  29. // ...
  30.  
  31. void Spierdol()
  32. {
  33.     fstream plik;
  34.     plik.open("Tego_Na_Pewno_Kurwa_Nie_Ma.txt");
  35.  
  36.     if(!plik.is_open()) throw ObslugaBledow(666);
  37.     // ...
  38.     if(!plik.good()) throw ObslugaBledow(667);
  39.     // ...
  40.     int zalozylem_gacie_na_lewa_strone = 0;
  41.     if(zalozylem_gacie_na_lewa_strone) throw ObslugaBledow;
  42. }
  43.  
  44. // ...
  45.  
  46. int main()
  47. {
  48.     try {
  49.         Spierdol();
  50.     } catch(ObslugaBledow blad) {
  51.         ObslugaBledow.print();
  52.     }
  53.  
  54. }
Add Comment
Please, Sign In to add comment