//------------------------------------------------------------------- // multable.cpp // // This program makes calls to an external function written in // assembly language in order to print a multiplication table. // // compile using: $ g++ multable.cpp product.o -o multable // execute using: $ ./multable // // programmer: ALLAN CRUSE // written on: 06 APR 2008 //------------------------------------------------------------------- #include // for printf() extern "C" int product( int x, int y ); /** { int i, s; if ( x < 0 ) { x = -x; y = -y; } s = 0; for (i = 0; i < x; i++) s += y; return s; } **/ int main( int argc, char **argv ) { for (int x = 0; x < 10; x++) { printf( "\n" ); for (int y = 0; y < 10; y++) printf( " %4d ", product( x, y ) ); } printf( "\n\n" ); }