Advertisement
Ronaldoztupang

Pola Unik

Sep 16th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int x,y,p,i;
  9.     char j;
  10.     cin>>x>>y>>p;
  11.     for(i=1;i<=((x*p)+x+1);i++)
  12.     {
  13.         if (i%(p+1)==1)
  14.         {
  15.             for(j=1;j<=((x*p)+x+1);j++)
  16.             {
  17.                 if(j%(p+1)==1)
  18.                 {
  19.                     cout<<"+";
  20.                 }
  21.                 else
  22.                 {
  23.                     cout<<"-";
  24.                 }
  25.             }
  26.             cout<<"\n";
  27.         }
  28.         else
  29.         {
  30.             for(j=1;j<=((y*p)+y+1);j++)
  31.             {
  32.                     if(j%(p+1)==1)
  33.                     {
  34.                         cout<<"|";
  35.                     }
  36.                     else if (((((y+1)+(p*y)-i+1)%(p+1))==(j%(p+1))) && (((i%(p+1)))==((j%(p+1)))))
  37.                     {
  38.                         cout<<"x";
  39.                     }
  40.                     else if ((((y+1)+(p*y)-i+1)%(p+1))== (j%(p+1)))
  41.                     {
  42.                         cout<<"/";
  43.                     }
  44.                     else if ((i%(p+1))==((j%(p+1))))
  45.                     {
  46.                         cout<<"\\";
  47.                     }
  48.                     else
  49.                     {
  50.                         cout<<"  ";
  51.                     }
  52.             }cout<<"\n";
  53.         }
  54.     }
  55.    
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement