Vector addition in C++...?
913984
// For any vector work I use structures.  For a 3-D vector define a structure as:\n\ntypedef struct\n{\n double x;\n double y;\n double z;\n} VECTOR;\n\n// Write a simple main to exercise some vector functions\n\nvoid main()\n{\n VECTOR VectorAdd(VECTOR A, VECTOR B);\n double VectorDot(VECTOR A, VECTOR B);\n VECTOR VectorCross(VECTOR A, VECTOR B);\n\n VECTOR a, b, c;\n double d;\n\n a.x = 1.0;\n a.y = 3.0;\na.z = 4.3;\n\n b.x = -2.3;\n b.y = 4.4;\n b.z = 1.1;\n\n c = VectorAdd(a, b);\n\n printf("Added: x: %lf, y: %lf, z: %lf&#92;n", c.x, c.y, c.z);\n\n c = VectorCross(a, b);\n\n printf("Crossed: x: %lf, y: %lf, z: %lf&#92;n", c.x, c.y, c.z);\n\n d = VectorDot(a, b);\n\n printf("Dotted: %lf&#92;n", d);\n\n}\n\nVECTOR VectorAdd(VECTOR A, VECTOR B)\n{\n VECTOR C;\n\n C.x = A.x + B.x;\n C.y = A.y + B.y;\n C.z = A.z + B.z;\n\n return C;\n}\n\nVECTOR VectorDot(VECTOR A, VECTOR B)\n{\n return A.x*B.x + A.y*B.y + A.z*B.z;\n}\n\nVECTOR VectorCross(VECTOR A, VECTOR B)\n{\n VECTOR C;\n\n C.x = A.y*B.z - A.z*B.y;\n C.y = A.z*B.x - A.x*B.z;\n C.z = A.x*B.y - A.y*B.x;\n\n return C;\n}
440005
Pseudocode, I'm not up on my Java syntax:\n\nint sum=0;\nfor(int i=0;i<array.size;i++)\n  sum+=array[i];
976275
2x + 28 < with a line under it _ <_   6x\n\nsorry don't know how to add that special character in, but it is only one thing like the +\n between the 28 and 6
943372
u have to ponit it or use\n\nthese are the 2 way's:\n\n#include <iostream>\nusing namespcae std;\nint main()\n{\nint num[8];\nint index;\n\nnum[0] = 42;\nnum[1] = 2001;\nnum[2] = 7;\nnum[3] = 180;\nnum[4] = 99;\nnum[5] = 1993;\n\nfor(index = 0; index <= 5; index++)\n{\nstd::cout<< index[num] << endl;\n}\n system("pause");\nreturn 0;\n}\n\nor\n\n#include <iostream>\n#define MAX 20\nusing namespcae std;\n\nint main()\n{\n\nint a[MAX] = {23,43,4,5,34,343,12,14};\nint b;\n\ncout.setf(ios::right);\n\nfor(b = 0; b < MAX; b++){\n\ncout << endl << endl;\n\ncout << "The Elemnt in ";\n\ncout.width(2);\n\ncout << (b +1) << " is ";\n\ncout.width(2);\n\nstd::cout << b[a];\n}\nreturn 0;\n}
649070
Your problem is that you are creating a vector of objects, when you really want to create a vector of pointers to those objects:\n\nvector <ClassName *> vecSouth;\n\nThen the following should work:\n\nvecSouth.push_back(new CLassName("images/menu.bmp", 1));\n\nsince the new is returning a pointer to a ClassName.  The only way to make your original version work would be to dereference the new'ed value.\n\nvecSouth->push_back(*(new ClassName.....));\n\nNote that it's usually preferable to have your containers store pointers to things vs copies of things (to avoid having multiple copies of objects and to avoid any confusion/ambiguity about exactly what is being stored.  Though you could have a reason to want to store copies, again, just be sure you're straight in your mind as to exactly what you want to do.
751588
Sorry.... i guess ur question a lil tricky.... Well i am C++ prog and work on the VC++ platform...
1164784
Add up one opposite vector (going up). In physics, they call it NORMAL FORCE.
444754
This sounds like school work, its a fairly simple program. you will probably want to use the cout and cin function which needs you to include iostream.h \n\nsimply use cout to print to screen, ask for input etc. then take the input using cin and store it to a int variable.\n\na good way to do it would be to ask the user what they wish to do, eg subtract, divide and take that operator first, a symbol or a number to show choice. then the next line asks for the numbers to be input.\n\neg:\n\n---------\n\nHello. what do you wish to do:\n1 - subtract\n2 - divide\n3 - etc etc\n\n>\n\n-------------\n\nthen use an if function or maybe a switch to check what their input was and do the artithmatic.\n\nso a very basic prgram may look like this:\nit may have errors i havant checked it.\n\n-----------------\n\n#include <iostream>\n\nint main() \n{\nint number;\n\n    cout << "Hello, input a number" << endl;\n    cin >>number;\n    return 0;\n}\n\n------\n\nEDIT; i re read the req, you might find inputting the selection to a char better, then check the char to see what symbol is stored in it, eg + / -. and maybe use a char array for the number input. simple take the char array, check for the space. split the numbers into 2 and caste then to an int. sounds complicated but it isnt to hard.\n\nsorry about spelling mistakes.
18728
Again I assume you are talking about vector addition.  In this case you use trig the angle and magnitude given to find the x and y components for each vector.  Then just add all of the x componets together and all of the y components together to get the sum.  Then you can use the pathagorean theorem and arctan to find the magnitude and direction of the resultant vector.
1052835
Let's start with an example of a vector space. An example is a plane. If we take any two points (we can make them vectors by drawing the points through the origin) in the plane and add them, the result will still be in the plane. If we take any scalar multiple of a vector in the plane, the result will still be in the plane. In fact, the resulting vector will be parallel to the original vector. \n\nIt's these two properties that make a vector space a vector space. In fact, what I said about the plane holds for any n-dimensional (n is any whole number that can be imagined) space. Further generalizations can be made to other examples that satisfy the addition and scalar multiplication properties mentioned above. But staying in the same space when adding or multiplying by a scalar are the key properties of a vector space.
1047890
class C\n{\npublic:\nenum { NUM_VALUES = 10 };\n\nprivate:\ndouble m_values[NUM_VALUES];\n\npublic:\n// Sets the number stored at index i in m_values to v\nvoid SetValue(int i, double v) throw( std::exception )\n{\nif ( i < 0 || i >= NUM_VALUES ) throw std::exception("Index out of range");\nm_values[i] = v;\n}\n\n// Gets the number stored at index i in m_values\ndouble GetValue(int i) const throw( std::exception )\n{\nif ( i < 0 || i >= NUM_VALUES ) throw std::exception("Index out of range");\nreturn m_values[i];\n}\n\n    // Returns the mean of the numbers stored in m_values\n    double GetMean(void) const \n    {\n        double sum = 0;\n        for ( int i = 0; i < NUM_VALUES; i ++ ) sum += m_values[i];\n        return sum / NUM_VALUES;\n    }\n\n    // Returns the sample standard deviation of the numbers stored in m_values\n    double GetStandardDeviation(void) const \n    {\n        double mean = GetMean();\n        double sum = 0;\n        for ( int i = 0; i < NUM_VALUES; i ++ ) sum += (m_values[i]-mean)*(m_values[i]-mean);\n        return sqrt(sum/(NUM_VALUES-1));\n    }\n};
368941
I can help you with this program in C (not C++).\n\n#include <stdio.h>\n\nint a;\n\nvoid main(void)\n{\n   for(a = 0; a <= 1000; a++)\n   {\n       printf("%d&#92;n", a);\n   }\n}\n\nThe above program lists numbers starting from 0 to 1000.\nYou can modify the program to add up all those numbers if that is what you want.\n\n#include <stdio.h>\n\nint a, sum = 0;\n\nvoid main(void)\n{\n   for(a = 0; a <= 1000; a++)\n   {\n      printf("%d&#92;n", a);\n      sum = sum + a;\n   }\n   printf("Sum = %d", sum);\n}\n\nThis program prints and also finds the sum to 1000 numbers starting from 0!
188148
try this:\n\nnumber of elements in the array is "n"\nnumbers are stored in array "Numbers"\n\nfor (i = 0; i < n - 2; i++)\n{\n   for (j = i + 1; j < n - 1; j++)\n   {\n      for (k = j + 1; k < n; k++)\n      {\n         cout << Array[i] << "," << Array[j] << "," << Array[k];\n      }\n   }\n}
245176
u*(u-2)+v*(u-2)\n(u+v)*(u-2)
636683
i think the 2 characteristics of a vector are-\n\nit has a definite direction and it follows the vector addition. i hope thats correct!!
170974
Prove that for  u,v, and w, p1=s(u)+t(v)+r(w), i.e that you can create a linear combination of vectors such that v=a1v1+a2v2+...+anvn.
769354
Not at all. Scalar or vector addition is not affected by order.