[BACK]Return to ts_natmat.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices

Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Matrices/ts_natmat.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io,integer_io;                 use text_io,integer_io;
                      2: with Standard_Natural_Matrices;
                      3: with Standard_Natural_Matrices_io;
                      4: with Multprec_Natural_Matrices;
                      5: with Multprec_Natural_Matrices_io;
                      6:
                      7: procedure ts_natmat is
                      8:
                      9: -- DESCRIPTION :
                     10: --   Tests the matrix packages of standard and multi-precision naturals.
                     11:
                     12:   procedure Test_Standard_io is
                     13:
                     14:     use Standard_Natural_Matrices,Standard_Natural_Matrices_io;
                     15:
                     16:     n,m : natural;
                     17:
                     18:   begin
                     19:     put("Give the number of rows : "); get(n);
                     20:     put("Give the number of columns : "); get(m);
                     21:     declare
                     22:       mat : Matrix(1..n,1..m);
                     23:     begin
                     24:       put("Give "); put(n,1); put("x"); put(m,1);
                     25:       put_line(" natural matrix : "); get(mat);
                     26:       put_line("Your matrix : "); put(mat); new_line;
                     27:     end;
                     28:   end Test_Standard_io;
                     29:
                     30:   procedure Test_Multprec_io is
                     31:
                     32:     use Multprec_Natural_Matrices,Multprec_Natural_Matrices_io;
                     33:
                     34:     n,m : natural;
                     35:
                     36:   begin
                     37:     put("Give the number of rows : "); get(n);
                     38:     put("Give the number of columns : "); get(m);
                     39:     declare
                     40:       mat : Matrix(1..n,1..m);
                     41:     begin
                     42:       put("Give "); put(n,1); put("x"); put(m,1);
                     43:       put_line(" natural matrix : "); get(mat);
                     44:       put_line("Your matrix : "); put(mat); new_line;
                     45:     end;
                     46:   end Test_Multprec_io;
                     47:
                     48:   procedure Main is
                     49:
                     50:     ans : character;
                     51:
                     52:   begin
                     53:     new_line;
                     54:     put_line("Interactive testing of matrices of natural numbers");
                     55:     new_line;
                     56:     loop
                     57:       put_line("Choose one of the following : ");
                     58:       put_line("  1. io of matrices of standard natural numbers.");
                     59:       put_line("  2. io of matrices of multi-precision natural numbers.");
                     60:       put("Make your choice (1/2) : "); get(ans);
                     61:       case ans is
                     62:         when '1' => Test_Standard_io;
                     63:         when '2' => Test_Multprec_io;
                     64:         when others => null;
                     65:       end case;
                     66:       put("Do you want more tests ? (y/n) "); get(ans);
                     67:       exit when ans /= 'y';
                     68:     end loop;
                     69:   end Main;
                     70:
                     71: begin
                     72:   Main;
                     73: end ts_natmat;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>