Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "head.h"
- int menu()
- {
- int color;
- cout<<"\t\t<<<<<----------Paint Program in C++---------->>>>>"<<endl;
- cout<<"\t<<<<<----------Done by Frooster and Ram Narayan---------->>>>>";
- cout<<"\nSelect color of brush:"<<endl;
- cout<<"1.Dark Blue\n2.Green\n3.Light Blue\n4.Red\n5.Pink\n6.Orange\n7.White\n8.Grey\n9.Purple\n10.Lime Green"<<endl;
- cout<<"Your Choice:";
- cin>>color;
- clrscr();
- gotoxy(35,6);
- cout<<"Instructions";
- gotoxy(10,7);
- cout<<"1.Wait for 5 secs for brush to load";
- gotoxy(10,8);
- cout<<"2.Press Arrow Keys to move brush...Next version will try";
- gotoxy(12,9);
- cout<<"to implement Mouse :P";
- gotoxy(10,10);
- cout<<"3.Press Arrow key once to move in the corresponding direction and";
- gotoxy(12,11);
- cout<<"tap once and hold key to continously move in one direction";
- gotoxy(10,12);
- cout<<"4.Tap two arrow keys simultaneously to move in a cross.Cannot";
- gotoxy(12,13);
- cout<<"hold two arrow keys to move continously...";
- gotoxy(35,14);
- cout<<"Good Luck....";
- return color;
- }
- void main()
- {
- int ch,i=100,j=250,color;
- color=menu();
- getch();
- clrscr();
- int gd=DETECT,gm;
- initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
- while(ch!=27)
- {
- int x=0,y=0;
- setcolor(color);
- circle(i,j,10);
- if(kbhit())
- {
- ch=getch();
- if(ch==72)//Down Arrow
- {
- x=0;
- y=-1;
- }
- if(ch==80)//Up Arrow
- {
- x=0;
- y=+1;
- }
- if(ch==77)//Right Arrow
- {
- x=+1;
- y=0;
- }
- if(ch==75)//Left Arrow
- {
- x=-1;
- y=0;
- }
- }
- i=i+x;
- j=j+y;
- delay(1);
- }
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment