| the big ben | 
			:??:  :??:  :??:  :??:  :??:  :??:  :??:  :??:   Quel qu un peu soit me dire pq ca ne va pas ou me dire ou trouver les sources pour m'aider a résoudre ce probleme !! :??:       #include <iomanip.h>
 #include <stdlib.h>
 const grand = 3;     //nb de données dans le tab de départ
 typedef int tableau[grand*2];
 class hanoi
 {
 private:
  tableau tab_dep, tab_posi, tab_neg, tab_temp;
  int top(tableau tab);
  int pop(tableau tab);
  void push(tableau tab,int nb);
  void deplacement(int n,tableau src, tableau dst, tableau temp);
 public:
  hanoi(int tab_depart[grand]);
  void select_deplac();
 };
 hanoi::hanoi(int tab_depart[grand])
 {
  for (int i = 0; i < (grand*2)1; ++i) tab_dep[i] = tab_depart[i];
  for (int j = 0; j < grand; ++j) { tab_posi[j]=0; tab_neg[j]=0;  tab_temp[j]=0;}
  tab_dep[grand*2] =grand1; tab_posi[grand*2] =0;  tab_neg[grand*2] =0; tab_temp[grand*2] =0;
 }
 int hanoi::top(tableau tab)
 {
  return tab[grand*2];
 }
 int hanoi::pop(tableau tab)
 {
  -tab[grand*2];
  return tab[tab[grand*2]+1];
 }
 void hanoi::push(tableau tab,int nb)
 {
  tab[tab[grand*2]] = nb;    ++tab[grand*2];
 }
 void hanoi::select_deplac()
 {
 /* if (top() < 0)  file://negatif
   deplacement(grand, tab_dep, tab_neg, tab_temp);
  else*/
   deplacement(grand, tab_dep, tab_posi, tab_temp);
 }
 void hanoi::deplacement(int n,tableau src, tableau dst, tableau temp)
 {
  if (n == 1)
  {
   cout << "deplacement de src vers dst"<< endl;;
   push(dst,pop(src));
  }
  else
  {    // for (int i= 7; i ==0 ; -i)  { cout << setw(3) << src[i] << "   " <<setw(3) << dst[i] << "   " <<setw(3) << temp[i] << endl; }
   deplacement(n1, src, temp, dst);
   deplacement(1, src, dst, temp);
   deplacement(n1, temp, dst, src);
  }
 }
   int main()
 {
  int tab_depart[grand];
  tab_depart[0]=1;tab_depart[1]=2;tab_depart[2]=3;
  
  hanoi H(tab_depart);
  H.select_deplac();
  return EXIT_SUCCESS;
 }    |