Why this program is stop working

#include<iostream>
#include<stack>
using namespace std;
long long n,v,i,j;
const int f=200;
stack<int>b;
bool a[f][f];
bool used[f];
void dfs(int m)
{for(int k=1;k<=n;k++)
if(a[m][k]==true&&used[k]==false)
{used[k]=true;
b.push(k);
cout<<k<<endl;
dfs(b.top());}
else {b.pop();dfs(b.top());}


if(b.empty())return;
}

int main ()
{
cin>>n>>v;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cin>>a[i][j];
}
}
used[v]=true;
b.push(v);
cout<<v<<endl;
dfs(b.top());
return 0;

}
Last edited on
You should repost this using the code tags: [ code ][ /code ] (without the spaces)
Topic archived. No new replies allowed.