Hey Folks,

I'm writing my first program outside of my intro c++ class...its supposed to take initial velocity and angle for a projectile and calculate its horizontal and vertical range. I've put the projectile into a class with variables initial velocity and initial angle. I've also tried to include and use trigonometry for the first time. My problem is that the user input of the initial velocity and angle is not replacing my initialized values for the member variables. If I can post the code correctly, I would appreciate some help...

Code:/* Title: Projectiles -- Two Dimensional Projectile Program Author: Sam Date: July 27, 2009 */ #include <iostream> #include <string> #include <cmath> using namespace std; class Projectile { double InitialVelocity; double InitialAngle; public: //constructors... Projectile () { ; } // default constructor Projectile (double v0, double Angle) { //initialzing constructor InitialVelocity = v0; InitialAngle = Angle; } //mutators... void SetInitialVelocity(double v0) { InitialVelocity = v0; } void SetInitialAngle(double Angle) { InitialAngle = Angle; } //accessors... double GetInitialVelocity() { return InitialVelocity; } double GetInitialAngle() { return InitialAngle; } }; void Menu(); double Collect(Projectile); void HRange(Projectile); int main() { Projectile Alpha; string Command; while (true) { Menu(); cout << "Command: "; getline (cin, Command); if (Command == "Quit") break; else if (Command == "Enter Initial Values") Collect(Alpha); else if (Command == "Calculate Horizontal Range") HRange(Alpha); } } void Menu() { cout << "\n============Menu============" << endl; cout << "Choices: " << endl; cout << "\t Enter Initial Values" << endl; cout << "\t Calculate Horizontal Range" << endl; cout << "\t Calculate Vertical Range (Height)" << endl; cout << "\t Quit" << endl; cout << "============================" << endl; } double Collect(Projectile Alpha) { int v0, Angle; cout << "Enter Initial Velocity: "; cin >> v0; cout << "Enter Initial Angle: "; cin >> Angle; cout << "Initial Velocity = " << v0 << " m/s" << endl; cout << "Initial Angle = " << Angle << " degrees" << endl; Alpha.SetInitialAngle(Angle); Alpha.SetInitialVelocity(v0); cin.ignore (100, '\n'); return 0; } void HRange(Projectile Alpha) { double g = 10; double XRange; double Pi = 3.1416; double CosRadianAngle; double SinRadianAngle; cout << Alpha.GetInitialAngle(); double RadianAngle = Alpha.GetInitialAngle() * Pi / 180; SinRadianAngle = sin (RadianAngle); CosRadianAngle = cos (RadianAngle); cout << "Sine of angle is: " << SinRadianAngle << endl; cout << "Cosine of angle is: " << CosRadianAngle << endl; XRange = (2*(Alpha.GetInitialVelocity() * Alpha.GetInitialVelocity() * CosRadianAngle * SinRadianAngle) / g); cout << "Horizontal Range = " << XRange << endl; }