Hi I am studying C++ programming and I am trying to make a Vector Addition Calculator. I get it to work for only 2 quadrants but the rest don't seem to work. Here is the code that I have written. It might be hard to follow but I would appreciate any help thats.

 ``` #include #include #include #include #include //#define PI 3.14159265 using namespace std; int main() { int magvec1; int angvec1; int magvec2; int angvec2; double vector1x, vector2y, vector3x, vector4y, Rx, Ry ,R3, R4, R5, angtheta; float ang; float angl; float mag; float angle; float Rangle; float TempAngle1,TempAngle2; float radang1, radang2; const float rad = 0.017453293; const float pi=3.14; cout<< "Hello! Welcome to Ramiro's Vector Addition Calculator." <> magvec1; cout<< "Please input Angle: "; cin >> angvec1; cout<< "Chose second Magnitude: "; cin >> magvec2; cout<< "Please second Angle: "; cin >> angvec2; float ANGCOS1,ANGSIN1,ANGCOS2,ANGSIN2; radang1 = angvec1 * rad; radang2 = angvec2 * rad; TempAngle1=radang1; TempAngle2=radang2; cout<<"the rad angle1 is " <
 ``12345`` ``````if (Rangle > 90 && Rangle <180) Rangle = Rangle + 180; else ( else (angvec1>90 && angvec2<180); Rangle = Rangle - 180;``````

Is this a mistake perhaps?
I commented it out but it only works in quadrant 2 and 3 only.
I made some minor changes and now it work in quadrants 3 and 4 only. Here is the new code.
 ``` #include #include #include #include #include //#define PI 3.14159265 using namespace std; int main() { int magvec1; int angvec1; int magvec2; int angvec2; double vector1x, vector2y, vector3x, vector4y, Rx, Ry ,R3, R4, R5, angtheta; float ang; float angl; float mag; float angle; float Rangle; float TempAngle1,TempAngle2; float radang1, radang2; const float rad = 0.017453293; const float pi=3.14; cout<< "Hello! Welcome to Ramiro's Vector Addition Calculator." <> magvec1; cout<< "Please input Angle: "; cin >> angvec1; cout<< "Chose second Magnitude: "; cin >> magvec2; cout<< "Please second Angle: "; cin >> angvec2; float ANGCOS1,ANGSIN1,ANGCOS2,ANGSIN2; radang1 = angvec1 * rad; radang2 = angvec2 * rad; TempAngle1=radang1; TempAngle2=radang2; cout<<"the rad angle1 is " <
Last edited on
Topic archived. No new replies allowed.