need help making the main

Write your question here.

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
  MATRIX <Structure>
    a11 <double>
    a12 <double>
    a21 <double>
    a22 <double>
END MATRIX

calc_sum(parameters: m1, m2, sum)
    set sum.a11 = m1.a11 + m2.a11
    set sum.a12 = m1.a12 + m2.a12
    set sum.a21 = m1.a21 + m2.a21
    set sum.a22 = m1.a22 + m2 a22
END calc_sum

calc_diff(parameters: m1, m2, diff)
    set diff.a11 = m1.a11 - m2.a11
    set diff.a12 = m1.a12 - m2.a12
    set diff.a21 = m1.a21 - m2.a21
    set diff.a22 = m1.a22 - m2 a22
END calc_diff

scalar_mult(parameters: k, m, k_m)
    set  k_m.a11 = k*m.a11
    set  k_ma12 =  k*m.a12
    set  k_m.a21 = k*m.a21
    set  k_m.a22 = k*m.a22
END scalar_mult

calc_inv(m, m_inv)
    set determinant = m.a11 * m.a22 - m.a21 * m.a12
    set m_inv.a11 = m.a22 / determinant
    set m_inv.a12 = -1 * m.a12 / determinant
    set m_inv.a21 = -1 * m.a21 / determinant
    set m_inv.a22 = m.a11 / determinant
END calc_inv


Hello guys, so I'm doing a group project with my classmates. They are doing the functions and I'm doing the main.

This program is on matrix operations, adding, subtracting, multiplying, scalar and inverse.

The functions are on getting the matrix, adding, subtracting, multiplying, scalar and inverse of the two matrice.

The functions are all in structures. Now I have to make the main for it, the main will be menu-drive.

Now I know that I have to use the switch statement to make a menu but I'd like to know a few things:

What variables do I need to initialize in the main?

How do I call the functions?

Also the switch statement's validation, how do I do that?

Can anyone give me a brief image or explanation?

Really appreciate since this class has been killing me, I'm horrible with designing things.
Topic archived. No new replies allowed.