I am doing a program to do dfs traversal given the adjacency matrix. My code follows:
#include <iostream>
#define SIZE 10
using namespace std;
bool M[SIZE][SIZE];
int flag[SIZE];
int dfsNum[SIZE], num;
int n;
void dfs( int u, int p )
{
flag[u] = 1;
dfsNum[u] = num++;
for( int v = 0; v < n; v++ ) if( M[u][v] && v != p )
{
if( flag[v] == 0 )
{
dfs( v, u );
}
}
flag[u] = 2;
}
int main()
{
cout<<"Enter number of vertices\n";
cin>>n;
cout<<"Enter adjacency matrix";
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>M[i][j];
for( int i = 0; i < n; i++ )
flag[i] = 0;
num = 0;
dfs( 0, 1 );
return 0;
}
Compiling with g++ goves errors:
dfs.cpp:33: error: stray ‘\302’ in program
dfs.cpp:33: error: stray ‘\255’ in program