'||||||||||||||||THE MATRIX TUTORIAL|||||||||||||||||||| '\\\\\\\\\\\by Truth and Reconciliation///////////// CLS DIM a(10, 10) COLOR 2 LOCATE 11, 33 PRINT "The MATRIX" LOCATE 13, 29 SLEEP 1 CLS LOCATE 11, 33 PRINT "TUTORIAL PROGRAM" LOCATE 13, 29 PRINT "press enter to continue" SLEEP top: COLOR 2 CLS PRINT " MENU " PRINT " ********" PRINT " 1)Input number of Rows/Columns in the MATRIX" PRINT " 2)Print Matrix and Show Row/Column Sums" PRINT " 3)Compute and Print the Trace of the Matrix" PRINT " 4)Print the Transpose" PRINT " 5)Quit" PRINT " 6)Help and Information" PRINT " *********************************************" PRINT " What is thy bidding, my master?" INPUT ":/>>"; m1 IF m1 = 1 THEN GOSUB thematrix1 ELSEIF m1 = 2 THEN GOSUB enterthematrix ELSEIF m1 = 3 THEN GOSUB trace ELSEIF m1 = 4 THEN GOSUB transpose ELSEIF m1 = 5 THEN CLS END ELSEIF m1 = 6 THEN GOSUB help ELSE GOSUB top '--- thematrix1: CLS INPUT "Number of Rows"; r INPUT "Number of Columns"; c FOR i = 1 TO r FOR j = 1 TO c PRINT "Number for Row"; i; "Column"; j; ":"; INPUT a(i, j) NEXT j NEXT i PRINT "press enter to continue" SLEEP GOSUB top '--- enterthematrix: CLS FOR i = 1 TO r FOR j = 1 TO c PRINT a(i, j); TAB(5 * j); NEXT j PRINT NEXT i '-RowSum- FOR i = 1 TO r sum = 0 FOR j = 1 TO c sum = sum + a(i, j) NEXT j PRINT "Sum for row "; i; "is"; sum NEXT i '-ColumnSum- FOR i = 1 TO r sum2 = 0 FOR j = 1 TO c sum2 = sum2 + a(j, i) NEXT j PRINT "Sum for column "; i; " is"; sum2 NEXT i PRINT "press enter to continue" SLEEP GOSUB top '--- trace: CLS IF r <> c THEN GOSUB top sum = 0 FOR i = 1 TO r sum = sum + a(i, i) NEXT i PRINT "The trace is "; sum PRINT "press enter to continue" SLEEP GOSUB top '--- transpose: CLS FOR i = 1 TO c FOR j = 1 TO r PRINT a(j, i); TAB(5 * j); NEXT j PRINT NEXT i PRINT "press enter to continue" SLEEP GOSUB top '--- help: '--- CLS PRINT "This program was made to teach simple Matrix Ops." PRINT "Any one new to Matrices in QB should follow the setup above" PRINT "Option 1: Allows you to create a Matrix" PRINT "Option 2: View Your Matrix" PRINT "Option 3: Compute the Trace (trace is the product of diagonal terms)" PRINT "Option 4: Print the Transpose (the Matrix on a new angle)" PRINT "Option 5: Quit the Program" PRINT "press enter to continue" SLEEP GOSUB helpmenu '--- helpmenu: COLOR 3 CLS PRINT " INFO" PRINT " *************" PRINT " 1) How the program works" PRINT " 2) Source Code Info" PRINT " 3) Return to Top Menu" PRINT " *******************************" PRINT " Input Your Choice Below" INPUT ":/>>"; m2 IF m2 = 1 THEN GOSUB how ELSEIF m2 = 2 THEN GOSUB source ELSEIF m2 = 3 THEN GOSUB top ELSE GOSUB helpmenu '--- how: '--- COLOR 3 CLS PRINT "This program uses basic Matrices with the traditional two for-next loops to display rows and columns. All of the above operations are simple reversals of the for-next structure to print the Matrices. The brackets are not displayed in QB (sorry!!)." PRINT "press enter to continue" SLEEP CLS PRINT " This program is intended to be a tutorial. It is not a work of art or a new innovation. If you know the above functions already, then dont bother continuing (IMPROVE THIS PROGRAM THOUGH!)" PRINT "press enter to continue" SLEEP GOSUB helpmenu '--- source: '--- COLOR 3 CLS PRINT "For-next structure in the Matrix:" PRINT "*********************************" COLOR 4 PRINT "for i=1 to r" COLOR 3 PRINT " THIS MEANS:the computer will realize the number of rows inputed below and draw them/add your numbers to them" COLOR 4 PRINT "for j=1 to c" COLOR 3 PRINT " This means: the computer will do the above funtions, but for columns" COLOR 4 PRINT "input a(i,j)" COLOR 3 PRINT " This means that you will input the remaining values" PRINT " i left off the print statement because its a basic function!! :)" PRINT "press enter to continue" SLEEP GOSUB helpmenu END IF END IF END