Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <conio.h>
- #include "windows.h"
- using namespace std;
- void gotoxy(int x, int y)
- {
- COORD c;
- c.X = x - 1;
- c.Y = y - 1;
- SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
- }
- int main(int argc, char *argv[])
- {
- int a, b;
- gotoxy(25,10);
- cout<<"Witamy w Grze o nazwie WONSZ!!!!!";
- gotoxy(1,15);//trzecia ramka
- cout<<char(218);
- for(int i=0; i<78; i++)
- cout<<char(196);
- cout<<char(191);
- for(int i=0; i<15; i++)
- {
- gotoxy(0,i+15);
- if(i==14) cout<<char(192);
- else cout<<char(179)<<endl;
- }
- gotoxy(2,30);
- for(int i=0; i<78; i++)
- cout<<char(196);
- gotoxy(79,19);
- for(int i=0; i<15; i++)
- {
- gotoxy(80,i+16);
- if(i==14) cout<<char(217);
- else cout<<char(179)<<endl;
- }
- int znak;
- int x=20,y=20;
- gotoxy(x,y);
- cout<<"@";
- int key;
- do
- {
- key = getch();
- if (key == 224 || key ==0 )
- {
- switch (getch ())
- {
- case 80 : y++;gotoxy(x,y); cout<<"@";
- gotoxy(x,y-1); cout << " ";
- break;
- case 72 : y--;gotoxy(x,y); cout<<"@";
- gotoxy(x,y+1); cout << " ";
- break;
- case 77 : x++;gotoxy(x,y); cout<<"@";
- gotoxy(x-1,y); cout << " ";
- break;
- case 75 : x--;gotoxy(x,y); cout<<"@";
- gotoxy(x+1,y); cout << " ";
- break;
- }
- }
- if ((y == 15)||(y==30)||(x==80)||(x==1)||key==27)break;
- }
- while (true);
- //system ("PAUSE")
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement