Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
70
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.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. const int wys =2;
  8. const int SZER =3;
  9. typedef unsigned char byte;
  10. const byte B_PRAWA=1;
  11. const byte B_DOLNA=2;
  12. const byte B_PUSTA=4;
  13. byte (*a) [szer+2]=NULL;
  14.  
  15. void Przygotuj ()
  16. {
  17. for (int y=1;y<=wys;y++)
  18. {
  19. for(int x=1; x<=SZER; x++)
  20. {
  21. a[y][x]=B_PRAWA|B_DOLNA;
  22. }
  23. }
  24. for (int x=1; x<=SZER; x++)
  25. {
  26. a[0][x]=B_DOLNA|B_PUSTA;
  27. a[wys+1][x]=B_PUSTA;
  28. }
  29. }
  30.  
  31. void Pokaz ()
  32. {
  33. cout<<" ";(a[y][x]&B_DOLNA?"_":" ")
  34. for(int x=1; x<=SZER; x++)
  35. {
  36. cout<<"_";
  37. }
  38. cout<<endl;
  39. for(int y=1; y<=wys; y++)
  40. {
  41. cout<<"|";
  42. for(int x=1; x<=SZER; x++)
  43. {
  44. cout<<(a[y][x]&B_DOLNA?"_":" ")<<(a[y][x]&B_PRAWA?"_":" ");
  45. }
  46. cout<<endl;
  47. }
  48. }
  49.  
  50. int main()
  51. {
  52. a=new byte[wys+2][SZER+2];
  53. Przygotuj();
  54. Pokaz();
  55. }
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement