diff options
| author | JacobAKnox <[email protected]> | 2021-12-03 11:51:11 -0800 |
|---|---|---|
| committer | JacobAKnox <[email protected]> | 2021-12-03 11:51:11 -0800 |
| commit | d0a97a57807fce1dbd093a96837bfd93120b141c (patch) | |
| tree | 6574bc670bbb44a864aa57eb84e4784734393d6b /project3/pseuodocode.txt | |
| parent | Add online IDE url (diff) | |
| download | cst116-proj3-jacobaknox-master.tar.xz cst116-proj3-jacobaknox-master.zip | |
Diffstat (limited to 'project3/pseuodocode.txt')
| -rw-r--r-- | project3/pseuodocode.txt | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/project3/pseuodocode.txt b/project3/pseuodocode.txt new file mode 100644 index 0000000..e01085b --- /dev/null +++ b/project3/pseuodocode.txt @@ -0,0 +1,80 @@ +main: + m1 = [][] + m2 = [][] + int choice = 0; + getMatricies(m1, m2); + menu(choice, m1, m2); + +menu(choice, m1, m2) + while choice != 4 + choice = readInt(menu, error message) + + switch + 1: + getMatrices(m1, m2) + 2: + multiply(m1, m2) + 3: + add(m1, m2) + 4: + outout exit message + defualt: + error try again + +getMatricies(&m1, &m2) + getMatrix(m1) + getMatrix(m2) + + +getMatrix(&m) + for (x 0-2) + for (y 0-2) + m[x][y] = readfloat(input value for x, y; error message) + +readInt(question, error) + int value + ouptut question + read input to value + while cin error + ouptut error + output question + read input -> value + return value + +readFloat(question, error) + float value + ouptut question + read input to value + while cin error + ouptut error + output question + read input -> value + return value + +printMatrix(m) + for (x 0-2) + for (y 0-2) + output m[x][y] + newline + +add(m1, m2) + result = [][] + for x 0-2 + for y 0-2 + result[x][y] = m1[x][y] + m2[x][y] + + printMatrix(result) + +multiply(m1, m2) + result = [][] + for x 0-2 + for y 0-2 + result[x][y] = dotproduct(x, y, m1, m2) + + printMatrix(result) + +dotproduct(x, y, m1, m2) + product = 0 + for i 0-2 + product += m1[x][i] * m2[i][y] + return product |