Design Problem of Computing Ii.: Title-Create A Maze Program To Find Out Path
Design Problem of Computing Ii.: Title-Create A Maze Program To Find Out Path
Submitted to:
Submitted by:
Mr.PAWAN KUMAR
ASHISH DHYANI
MCA(H)
ERNO.10812279
ROLLNO--40
ashish dhyani
e roll. 10812279
rollno --40
*/
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
class p
{
private:
char **p,*start,*end;
public:
void getdata();
void showdata(int,int,char**);
p()
{
start=NULL;
end=NULL;
}
};
*p=(char*)malloc(rows*cols);
cout<<"\n ******user manual *****\n\n user have to
use only four keywords \n\n 1.# at the beginning\n\n 2.1
or 0 in between\n\n 3. @ at the last as destinnation point";
cout<<"wrong keywords will lead to system failure
\n\n***** enter your keywords*******\n\n\t";
for(int i=0;i<rows;i++)
{
for (int j=0;j<cols;j++)
{
cin>>(*(*(p+i)+j));
if((*(*(p+i)+j))=='#')
{
if(init==0)
{
start=&(p[i][j]);
init++;
}
else
{
cout<<endl<<"Sorry !!! you are on
wrong way \n pls try right keywords";
j--;
}
}
else if((*(*(p+i)+j))=='@')
{
if(last==0)
{
end=&(p[i][j]);
last++;
}
else
{
cout<<endl<<"Sorry !!! you are on
wrong way \n pls try right keywords";
j--;
}
clrscr();
if(start==NULL || end==NULL)
{
cout<<"source not available.";
}
else
{
cout<<endl<<endl<<"\n\n The required ways of
the maze are.\n";
for(i=0;i<rows;i++)
{
cout<<endl<<endl;
for (int j=0;j<cols;j++)
{
cout<<" "<<*(*(p+i)+j);
}
}
}
showdata(rows,cols,p);
}
{
int i=0;
int j=0;
do{
else
if((i>=0 && j-1>=0 && i<=m-1 && j-1<=n-1) && a[i][j1]==0)
{
j--;
a[i][j]=2;
}
else if((i-1>=0 && j>=0 && i-1<=m-1 && j<=n-1) && a[i-1]
[j]==0)
{
i--;
a[i][j]=2;
else
if((i>=0 && j+1>=0 && i<=m-1 &&j+1<=n-1) && a[i]
[j+1]==2)
{
a[i][j]=3;
j++;
}
i--;
}
}
while( ( i!=m-1) &&( j!=n-1));
}
void main()
{
p o;
clrscr();
o.getdata();
getch();