Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python

C++


JAVA
PHP
SQL
Alice

Hanoi-Array


Description

Download zip file (Right click)
Download tar/gzip file (Right click)

Makefile
hanoi.cpp
hanoi.h
solvehanoi.cpp
testhanoi.cpp

testhanoi.cpp

// testhanoi.cc
//
// Charles A. Cusack, August 2000
//
// A program to do testing for the Hanoi class.
//
//-------------------------------------------------------------------------
#include "hanoi.h"
//-------------------------------------------------------------------------
void Do_Something();
void Do_a_Little(Hanoi H);
//-------------------------------------------------------------------------
int main (int argc,char* argv[]) {

if(argc!=1 ) {     // Check for correct number of command line arguments.
    cout<<"USAGE: "<<argv[0]<<"\n"; 
    exit(1); 
    }

Do_Something();          // An example of why we should have destructors.

Hanoi Tower(10,3);    // Get A Towers of Hanoi with 3 pegs and 10 discs.

cout<<"Tower:\n";
Tower.Show_Towers();

Tower.Move_Disc(0,2);

cout<<"Tower:\n";
Tower.Show_Towers();

Do_a_Little(Tower);         // An example of why we need copy constructors.

cout<<"Tower:\n";
Tower.Show_Towers();

Hanoi Blah(Tower);

Hanoi Foo=Tower;

return 0;
}
//-------------------------------------------------------------------------
void Do_Something() {
     Hanoi A;
     Hanoi B(1000,34);
     }
void Do_a_Little(Hanoi H) {
        Hanoi B=H;
        cout<<"B:\n";
        B.Show_Towers();
        B.Move_Disc(0,1);
        cout<<"B:\n";
        B.Show_Towers();
        //B.Move_Disc(1,3);
     }
//-------------------------------------------------------------------------