Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- const int wys =2;
- const int SZER =3;
- typedef unsigned char byte;
- const byte B_PRAWA=1;
- const byte B_DOLNA=2;
- const byte B_PUSTA=4;
- byte (*a) [szer+2]=NULL;
- void Przygotuj ()
- {
- for (int y=1;y<=wys;y++)
- {
- for(int x=1; x<=SZER; x++)
- {
- a[y][x]=B_PRAWA|B_DOLNA;
- }
- }
- for (int x=1; x<=SZER; x++)
- {
- a[0][x]=B_DOLNA|B_PUSTA;
- a[wys+1][x]=B_PUSTA;
- }
- }
- void Pokaz ()
- {
- cout<<" ";(a[y][x]&B_DOLNA?"_":" ")
- for(int x=1; x<=SZER; x++)
- {
- cout<<"_";
- }
- cout<<endl;
- for(int y=1; y<=wys; y++)
- {
- cout<<"|";
- for(int x=1; x<=SZER; x++)
- {
- cout<<(a[y][x]&B_DOLNA?"_":" ")<<(a[y][x]&B_PRAWA?"_":" ");
- }
- cout<<endl;
- }
- }
- int main()
- {
- a=new byte[wys+2][SZER+2];
- Przygotuj();
- Pokaz();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement