Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Writing a matrix and vector class, if done properly, is something you should onl

ID: 3559627 • Letter: W

Question

Writing a matrix and vector class, if done properly, is something you should only need to do a handful of times in your programming career. Given that these classes are essential to computer graphics, we are going to work on our own versions now. Using Microsoft Visual Studio 2010 and C++. Please write a program that does the following: Runs on the console Allows the user to perform the following actions: Addition of two vectors o Subtraction of two vectors o The dot product of two vectors o The cross product of two vectors Multiply a vector by a matrix o Multiply a matrix by a matrix Accepts input from the user of the following format: For vectors Ask for three numbers, separated by commas o For matrices For each row Ask for four numbers, separated by commas Outputs the result of the calculation in a human-readable format

Explanation / Answer

1) Add 2 vector in C++

Add 2 vector in VB

                                            Public Shared Operator +(

                                                        _ vector1 As Vector,

                                                        _ vector2 As Vector _

                                                    ) As Vector

                                                    vectorResult = vector1 + vector2

                                                    Return vectorResult

                                                    End Function

2) Subtract two vectors c++

Subtract two vectors in VB

                                              Dim vectorResult As Vector = Vector.Subtract(vector1, vector2)

                                              Return vectorResult

                                              End Function

3) Dot product of Vector in C++

Dot product of Vector in VB