Advertisement
Guest User

Valentinovo @ foi 2

a guest
Feb 12th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6.     double x, y, size = 15;
  7.     char ch = 3;
  8.     int print_line = 3;
  9.     string message = " Love is in the air... :) ";
  10.     for (x = 0; x<size; x++)
  11.     {
  12.         for (y = 0; y <= 4 * size; y++)
  13.         {
  14.             double dist1 = sqrt(pow(x - size, 2) + pow(y - size, 2));
  15.             double dist2 = sqrt(pow(x - size, 2) + pow(y - 3 * size, 2));
  16.             if (dist1 < size + 0.5 || dist2 < size + 0.5)
  17.             {
  18.                 cout << ch;
  19.             }
  20.             else cout << " ";
  21.         }
  22.         cout << "\n";
  23.     }
  24.     for (x = 1; x<2 * size; x++)
  25.     {
  26.         for (y = 0; y<x; y++) cout << " ";
  27.         for (y = 0; y<4 * size + 1 - 2 * x; y++)
  28.         {
  29.             if (x >= print_line - 1 && x <= print_line + 1)
  30.             {
  31.                 int idx = y - (4 * size - 2 * x - message.length()) / 2;
  32.                 if (idx < message.length() && idx >= 0)
  33.                 {
  34.                     if (x == print_line) cout << message[idx];
  35.                     else cout << " ";
  36.                 }
  37.                 else cout << ch;
  38.             }
  39.             else cout << ch;
  40.         }
  41.         cout << endl;
  42.     }
  43.     cout << endl;
  44.     system("pause");
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement