Sunday, 15 December 2013

For Loop Maze

Hi friends!
Here is a new use of For Loop.
Use the given code below and  you can make a maze with the help of C++ programming language.
Stay tuned for more updates.




/*Language: C++
Category: Pattern
Description: Special For loop use
*/
#include
#include
#include
#include
#define size 51
// Initializations
int li,lp;
// Main Fuction
void main(void)
{
clrscr();
// THE MAIN LOGIC !!
for(li=10;li<71 li="" p="">{
gotoxy(li,15);
delay(30);
textcolor(BLINK + BLUE);
cprintf("\/");
}
for(li=70;li>=10;li--)
{
gotoxy(li,22);
delay(30);
textcolor(RED);
cprintf("\\");
}
for(lp=16;lp<=21;lp++)
{
gotoxy(10,lp);
delay(100);
textcolor(BLUE);
cprintf("-");
}
for(lp=21;lp>=16;lp--)
{
gotoxy(70,lp);
delay(100);
textcolor(BLINK + RED);
cprintf("=");
}
gotoxy(16,17);
textcolor(MAGENTA);
cprintf("Hello World");
gotoxy(12,20);
textcolor(2);
cprintf("\n Do You Like This \t\t\t\t Use of For Loop");
getch();
}// Main Fuction End

2 comments: