Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. o#include<iostream>
  2. #include<cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     double x, y,
  9.     size=10;
  10.     char ch=3;
  11.     string message(" Te amo Vicky <3 ");
  12.     int print_line = 4;
  13.  
  14.     if(message.length() % 2 != 0)
  15.         message += " ";
  16.  
  17.     for(x=0;x<size;x++)
  18.     {
  19.         for(y=0;y<=4*size;y++)
  20.         {
  21.             double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );
  22.             double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );
  23.  
  24.             if (dist1 < size + 0.5 || dist2 < size + 0.5 ) {
  25.                 cout<< ch;
  26.             }
  27.             else
  28.                 cout<< " ";
  29.         }
  30.  
  31.         cout<<"\n";
  32.     }
  33.  
  34.     for(x=1;x<2*size;x++)
  35.     {
  36.         for(y=0;y<x;y++)
  37.             cout << " ";
  38.  
  39.         for (y=0;y<4*size + 1 - 2*x; y++)
  40.         {
  41.             if (x>= print_line - 1 && x <= print_line + 1) {
  42.                 int idx = y - (4*size - 2*x - message.length()) / 2;
  43.                 if(idx < message.length() && idx >= 0) {
  44.                     if (x == print_line)
  45.                         cout<<message[idx];
  46.                     else cout << " ";
  47.                 }
  48.                 else
  49.                     cout << ch;
  50.             }
  51.             else
  52.                 cout<< ch;
  53.         }
  54.         cout<<endl;
  55.     }
  56.  
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement