Practice program

I'm trying to create a program that can help me with some statics problems I've been doing.

I have it set up to where I input the coordinates for each important point and do fine until it comes time to get me total forces in x,y,z. I think this has something to do with the need to divide in order to get my unit vectors. Here is my problem area:

double AB, AC, AD;
				AB = (pow(Bx - Ax, 2) + pow(By - Ay, 2) + pow(Bz - Az, 2));
				AC = (pow(Cx - Ax, 2) + pow(Cy - Ay, 2) + pow(Cz - Az, 2));
				AD = (pow(Dx - Ax, 2) + pow(Dy - Ay, 2) + pow(Cz - Az, 2));

				cout << "These are the magnitudes of each vector from A;\n";

				double FBx, FBy, FBz, FCx, FCy, FCz, FDx, FDy, FDz;
				cout << pow(AB, .5) << '\t' << pow(AC, .5) << '\t' << pow(AD, .5) << endl;
				FBx = FB * (Bx / AB);
				FBy = FB * (By / AB);
				FBz = FB * (Bz / AB);
				FCx = FC * (Cx / AC);
				FCy = FC * (Cy / AC);
				FCz = FC * (Cz / AC);
				FDx = FD * (Dx / AD);
				FDy = FD * (Dy / AD);
				FDz = FD * (Dz / AD);
				cout << FB << FBy << endl;
				
				double Fx, Fy, Fz;
				Fx = FBx + FCx + FDx;
				Fy = FBy + FCy + FDy;
				Fz = FBz + FCz + FDz;
				
				cout << "Sum of the vectors:\n";
					cout << Fx << '\t' << Fy << '\t' << Fz << endl;
				double magVtotal;
				magVtotal = pow(Fx, 2) + pow(Fy, 2) + pow(Fz, 2);
				cout << "The total magnitude of these vectors:" << pow(magVtotal, .5) << endl;


My guess is that my problem starts here: FBx = FB * (Bx / AB); Notably the Bx / AB. These are always going to be less than one. Since I use these variables in my pow function and as division here I'm not totally sure what to declare them as. Any help would be appreciated!
What is the value of Bx, is it initialized
user has to input the value of each coordinate. For the example I'm working off of though it is 0.
I fixed it. I had a small mistake in variable placement. Program can do statics problems with antenna attached to 3 cables. Now i just need to find a way to make more general and for 'n' cables.
Topic archived. No new replies allowed.