Advertisement
Guest User

chuuj

a guest
Nov 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int w,s;
  8.  
  9. char znak;
  10. cout<<"Podaj wysokosc prost: "; cin>>w;
  11. cout<<"Podaj szerokosc prost: "; cin>>s;
  12. cout<<"Podaj znak graficzny: "; cin>>znak;
  13. float pustewiersze=(25-w)/2,ilespacji=(80-s)/2;
  14.  
  15. system("cls"); ///clear screean
  16. for(int i=1 ;i<=pustewiersze ;i++ )
  17. {
  18. cout<<endl;
  19. }
  20. for(int i=1 ;i<=ilespacji ;i++ )
  21. {
  22. cout<<" ";
  23. }
  24. for (int i=1; i<=s; i++) /// 1-sza linia
  25. {
  26.  
  27. cout << znak;
  28. }
  29. cout<<endl;
  30. for (int i=1;i<=w-2;i++) /// srodkowe linie
  31. {
  32. for(int k=1 ;k<=ilespacji ;k++ )
  33. {
  34. cout<<" ";
  35. }
  36. cout<<znak;
  37. for (int j=1; j<=s-2; j++)
  38. {
  39.  
  40. cout<<' ';
  41. }
  42. cout<<znak<<endl;
  43. }
  44. for(int d=1 ;d<=ilespacji ;d++ )
  45. {
  46. cout<<" ";
  47. }
  48. for (int i=1; i<=s; i++) /// ostatnia linia
  49. {
  50.  
  51. cout << znak;
  52. }
  53. cout<<endl;
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement