// reset vector from rectangular coordinates if form is // RECT (the default) or else from polar coordinates if // form is POL void Vector:: reset(double n1, double n2, Mode form) { mode = form; if (form == RECT) { x = n1; y = n2; set_mag(); set_ang(); } else if (form == POL) { mag = n1; ang = n2 / Rad_to_deg; set_x(); set_y(); } else { cout << "Incorrect 3rd argument to Vector() -- "; cout << "vector set to 0\n"; x = y = mag = ang = 0.0; mode = RECT; } }
void Vector::set(double n1, double n2, char form) { mode = form; if ( form == 'r') { x = n1; y = n2; set_mag(); set_ang(); } else if (form = 'p') { mag = n1; ang = n2 / Rad_to_deg; set_x(); set_y(); } else { cout << "Incorrect form\n"; cout << "vector set to 0\n"; x = y = mag = ang = 0.0; mode = 'r'; } }
void Vector::reset(double n1, double n2, Mode form = RECT) { mode = form; if (form == RECT) { x = n1; y = n2; set_mag(); set_ang(); } else if (form == POL) { mag = n1; ang = n2 / Rad_to_deg; set_x(); set_y(); } else { cout << "Niepoprawny trzci argument set() -- zeruję wektor" << endl; x = y = mag = ang = 0.0; mode = RECT; } }
Vector::Vector(double n1, double n2, Mode form = RECT) { mode = form; if (form == RECT) { x = n1; y = n2; set_mag(); set_ang(); } else if (form == POL) { mag = n1; ang = n2 / Rad_to_deg; set_x(); set_y(); } else { cout << "Niepoprawna wartość trzeciego argumentu Vector() -- zeruję wektor" << endl; x = y = mag = ang = 0.0; mode = RECT; } }