#!/bin/ch //************************************************************* // makematrix.cgi // creates a matrix of size specified // by the client. Submits operation options // to matrixCalculator.cgi. // History: created by Harry H. Cheng, 2/8/1996 // Last modified: 2/22/96 //************************************************************* #include void errorHandler(char *reason) { printf("Web Matrix Calculator Failed\n"); printf("\n"); printf("

Web Matrix Calculator Failed

\n"); printf("Your mathematical expression has not been submitted to Matrix Calculator,\n"); printf("because %s. ",reason); printf("Try again.\n"); printf("


\n"); printf("\n"); printf("\"Powered\n"); exit(1); } int main() { int num, i, j, rowA, colA, rowB, colB, matrixNum; chstrarray name; chstrarray value; string_t reason; class CResponse Response; class CRequest Request; Response.setContentType("text/html"); Response.begin(); num = Request.getFormNameValue(name, value); if(num==0 || value[0]==NULL) { printf("No name/value has been submitted

\n"); exit(0); } for(i=0;i\n"); printf("\n"); printf("Web Matrix Calculator \n"); printf("\n"); printf("\n"); printf("\n"); printf("

Web Matrix Calculator

\n"); printf("
\n"); printf("
\n"); printf("\n", matrixNum); if(num == 1) { printf("\n", rowA); printf("\n", colA); } if(num == 4) { printf("\n", rowA); printf("\n", colA); printf("\n", rowB); printf("\n", colB); } printf("A = \n"); printf("
"); for(i=1;i<=rowA;i++) { for(j=1;j<=colA;j++) printf("\n", i, j, i+j); printf("
\n"); } if(num!=1) { printf("

\n"); printf("B = \n"); printf("
"); for(i=1;i<=rowB;i++) { for(j=1;j<=colB;j++) { printf("\n", i, j, i+j); } printf("
\n"); } } printf("

\n"); printf("Expression\n
\n"); if(num!=1) printf("

\n", "transpose(A)*B"); else printf("

\n", "2*A"); printf("\n"); printf("\n"); printf("
\n"); printf("


\n"); printf("\n"); printf("\"Powered\n"); printf("\n"); printf("\n"); Response.end(); exit(0); }