JosepRivaille

P80097: El rusc d'abelles

Apr 9th, 2015
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void buits(int n) {
  6.     if (n > 0) {
  7.         cout<< " ";
  8.         buits(--n);
  9.     }
  10. }
  11.  
  12. void pintar_rusc(int f, int c) {
  13.     bool ini = true;
  14.     while (f != 0) { //Cada fila
  15.         //Top
  16.         bool inici = true;
  17.         if (ini) {
  18.             for (int i = c; i != 0; --i) {
  19.                 if (inici) buits(1);
  20.                 if (not inici) buits(3);
  21.                 cout << "_";
  22.                 inici = false;
  23.             }
  24.         }
  25.         ini = false;
  26.         cout << endl;
  27.         //MidAbove
  28.         int k = c-1;
  29.         for (int j = c; j != 0; --j) {
  30.             cout << "/";
  31.             buits(1);
  32.             cout << char(92);
  33.             if (k != 0) cout << "_";
  34.             --k;
  35.         }
  36.         cout << endl;
  37.         //MidBelow
  38.         int n = c-1;
  39.         for (int m = c; m != 0; --m) {
  40.             cout << char(92) << "_" << "/";
  41.             if (n != 0) buits(1);
  42.             --n;
  43.         }
  44.         --f;
  45.     }
  46.     cout << endl;
  47. }
  48.  
  49.  
  50. int main() {
  51.     int f, c;
  52.     bool primer = true;
  53.     while (cin >> f >> c) {
  54.         if (not primer) cout << endl;
  55.         pintar_rusc(f, c);
  56.         primer = false;
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment