Hi, How do i write a vector class to manipulate vectors in 3D; manipulate vector components in Cartesian, cylindrical, and spherical coordinate systems; add vectors; multiply by scalars; compute dot and cross products?

The obvious approach most Vector3D classes use it to represent the data in one form and convert from input in another form into it (e.g. leave the vector in cartesian for and convert from spherical and cylindrical input). Depending on the problem that is a viable solution [not always].

Then it is a matter of doing one thing at a time. I would actually recommend writing the output first, that greatly helps with debugging, so you have a class like this:

class Vector3D
{
private:
double x,y,z; // This can be done in many ways,but I have chosen discrete
// values. [you can use an array, etc]
public:
Vector3D(); // Default constructor [e.g. set x,y,z to zero]
Vector3D(const Vector3D&); // ALWAYS write a copy constructor
Vector3D& operator=(const Vector3D&); // ALWAYS write an assignment operator
~Vector3D() {} // Destructor
void write(std::ostream&) const; // Write should be constant
};
// This is implemented in the standard way
std::ostream& operator<<(std::ostream& OutStream,const Vector3D& A)
{
A.write(OutStream);
return OutStream;
}

Then all you have to write is a simple write method and the constructors/copy constructors and you can star doing stuff with your class. Initially, the vector 0,0,0 is a bit boring, so you start to increase the scope, e.g. an constructor that takes three values, test that and build up the class.

After a bit you add this:

class Vector3D
{
// stuff....
public:
// stuff...
Vector3D& operator+=(const Vector3D&);
Vector3D operator+(const Vector3D&,const Vector3D&) const;
// then to multiply by a scalar
Vector3D& operator*=(const double);
// etc...
};

If you actually want to change the manipulation set e.g. for some problems use spherical coordinates and others to use something else, then the best way to do that
is to have a base Vector3D and then inherit them into a SphericalVec etc.

When you have some more code and get confused/stuck etc. post your code and we can see if we can help.

Do you know how to do all of the transformations from a mathematical standpoint (i.e., pencil and paper)? If not, first start with a good reference book or Wikipedia article and figure out the mechanics of it.

I want to draw a triangle using mouse events like mousePressed(), mouseReleased() and mouseDragged(). But triangle did not show until mouse release. Please tell me what i am ...

Please I have an autocomplete textbox which fetches value from a tabe in the database. But after i choose the name i want to get the id of the value ...