hamiltonian circuit

hello, in my program have array of objetcs about of a atraction park in my class atraction have 2 attribute string (for the name) and integer x (fun level), I read m (quantify) of atractions n the populars atraction (atraction with more fun level)and h (quantify of ways that conect atractions)
I create a matrix of bool that full of false, and other double for read points x and y and I do mat[i][j] =mat[j][i] = true for conect them, because that is a adyacent matrix then is simetric.

Now all points is true, but I don't know how do that verific if have a hamiltonian ciucuit

example: ponits x and y
0 1
2 1
0 2

the two circuits are 0120 y 0210 . please help me with my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 #include <iostream>
#include <string>
using namespace std;

class atraccion {
	private:
	int x;
	string name;
	public:
	
	atraccion () {} 
	atraccion (int var, string nnombre){
		x=var;
		name = nnombre;
	}
	~atraccion() {}
	
	void set_x (int val) { 				//modifica el x
		x = val;
	}
	
	int get_x () {						//devuelve el x
		return x;
	}
	
	void set_name ( string nom) {			//modifica el nombre
		name =nom;
	}
	
	string get_name () {					//devuelve el nombre
		return name;
	}
};



int main (){
	int m, n, h,div;
	int posmayor,mayor;
	bool mat[10][10];
	int x,y;
	string nombre;
	atraccion intercambio;
	
	cin>>m>>n>>h;
	
	atraccion ar [m];		//arreglo que almacena cada atraccion 
	
		for (int i=0;i<m;i++) {
			cin>>nombre;
			cin>>div;
			ar[i].set_name(nombre);
			ar[i].set_x (div);
		}
		
		for( int g=0;g<10;g++){				//matriz de adyacencia
			for (int f=0;f<10;f++){
			mat[g][f] =false;
		}
		}
		
		for (int d=0;d<=h-1;d++){			//marca true 
			for (int e=0;e<=h-1;d++){
				cin>>x>>y;
				d=x;
				e=y;
				mat[d][e] =mat[e][d]= true;
			}
		}
		
		for (int w=0;w<=m-2;w++){               //ordenamiento //modelo 2
            posmayor = w;
            mayor = ar[w].get_x();
            for (int k=w+1; k<=m-1; k++){
				if ((ar[k].get_x() == mayor) && (ar[k].get_name () < ar[w].get_name())){
					mayor= ar[k];
					posmayor=k;
				}else{
                if (ar[k].get_x() > mayor) {
                    mayor = ar[k].get_x();
                    posmayor =k;
					}
				}
            }
            
            intercambio = ar[posmayor];		//se encarga de cambiarlos 
            ar[posmayor] =ar[w];
            ar[w] = intercambio;
		}
		
		for (int j=0;j<n;j++) {
			cout<<ar[j].get_name()<<endl;
		}
		
		
	return 0;
}
Please don't start a new thread for every question about the same program.
Esxpecially when you haven't fixed the problems that were pointed out to you in another thread.
http://www.cplusplus.com/forum/beginner/165568/
http://www.cplusplus.com/forum/beginner/165209/
http://www.cplusplus.com/forum/beginner/165197/
Topic archived. No new replies allowed.