1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
|