Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int v;
  9.       int sx,d,sy;
  10.     double r;
  11.     cin >>r;
  12.     sx=r;
  13.     sy=r;
  14.     cin>>v;
  15.     int k=0;
  16.     int z=2*v-1;
  17.  
  18.     for(int y=0;y<=r;y++)
  19.     {
  20.         for(int x=0;x<=2*r;x++)
  21.         {
  22.             d=sqrt(pow(sx-x,2)+pow(sy-y,2));
  23.             if(d<=r)
  24.                 cout<<"*";
  25.             else
  26.                 cout<<" ";
  27.         }
  28.         cout << endl;
  29.     }
  30.     while(k<v)
  31.         {
  32.             int x=0;
  33.             while (x<k)
  34.             {
  35.                 cout<<" ";
  36.                 x++;
  37.             }
  38.             x=0;
  39.             while(x<z)
  40.             {
  41.             cout<<"*";
  42.             x++;
  43.              }
  44.         z=z-2;
  45.         cout<<endl;
  46.         k++;
  47.  
  48.         }
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement