I was looking for a way to a find three dimensional force vector. I currently in high school taking physics and thought is would be cool if I created a program that would be able to do this. The only bad part is that I'm not sure how to begin. I'm a beginner in c++ so I want to learn how it is done.
If you want to make a vector, not an array, then you declare it like: vector <variable type> name
Obviously you choose what the name and type is.
Example: vector <int> myArray;
To declare an array, you write: variable typename [how many sections you want];
Example: int myArray[5];
You can access both my using the [] accessor.
Example: myArray[x];
To make the array multi-dimensional, when you declare it write int myArray[5][5][5];
That creates an array with 125 members: [0][0][0], [0][0][1], [0][0][2]... ...[4][4][3], [4][4][4].
Multidimensional vectors are a tad more confusing. To declare one: vector <vector <vector <int> > > myArray
This makes a vector, where each section is a vector, where each section is a vector, where each section is an integer, or whole number. This is accessed just like the multi-dimensional array.
I'm not sure if this is what you wanted, but that's what I understand 3-dimensional vectors/arrays to be.
I'm assuming you mean that you'll enter the force components in three separate dimensions (let's call them x, y and z) and you want to write a C++ program to calculate the single resultant force's magnitude and direction?
I made a little program which uses the polar coordinates of two 2D vectors to calculate the polar coordinates of a third 2D vector.
polar coordinates are really a LOT better for calculating 2D vectors than Cartesian xy coordinates, because for those you need to know how to add, subtract, multiply, and divide complex numbers(a + bi), while for polar coordinates all you need to know is how to add, subtract, multiply and divide real numbers and how to find the average of angles(easy).