Advertisement
rengetsu

ProcedurProgramavimas_2.11

Mar 12th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. string one="-",two="O";
  7. int q,t,kol,zz=0;
  8. cin>>q;
  9. kol=(q-1)/2;
  10. t=q-kol;
  11. for(int g=0;g<t;g++)
  12. {
  13.     for(int i=0;i<q;i++)
  14.     {
  15.     if(i==kol || i==kol+zz)
  16.     {cout<<two;}
  17.     else
  18.     {cout<<one;}
  19.     }
  20. zz+=2;
  21. cout<<endl;
  22. kol--;
  23. }
  24. int dol=1;
  25. for(int s=0;s<t-1;s++)
  26. {
  27.     for(int v=0;v<q;v++)
  28.     {
  29.         if(v==dol || v==((q-1)-dol))
  30.         {cout<<two;}
  31.         else
  32.         {cout<<one;}
  33.     }
  34. cout<<endl;
  35. dol+=1;
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement