Hello!

I am considerably new in C++ and need some of your advises!

Actually I am doing my assignment and getting some troubles in the way.

I am using Microsoft Visual C++ (from Visual Studio .Net 2005)

While I try to compile my code, I get the following erros:

error C3861: 'getX': identifier not found

error C3861: 'getY': identifier not found

error C3861: 'resMag': identifier not found

error C3861: 'resDir': identifier not found

It seems to me that I have to make the classes getX, getY, resMag and resDir PUBLIC. But I do not see the proper reason for that.

I am providig the code to help you out understand the problem better:

Thank youCode:/* Developer : Nirali Patel Course : CSCI 201 Project : Assignment #1 - VECTORS Date : 09/23/2006 File : vector.cpp Description: vector class. */ #include <iostream> #include <stdlib.h> #include <cmath> using namespace std; class vector { private: double dir; // Vector direction double mag; // vector magnitude double getX(double, double); // Get horizontal components of the vectors double getY(double, double); // Get vertical components if the vectors double resDir(double, double); // Resultant Directions double resMag(double, double); // Resultant Magnitudes public: vector(); // Constructor to make the Vector NULL vector(vector &temp); // Constructor to copy the Vector friend vector operator + (const vector& lhs, const vector& rhs); friend vector operator - (const vector& lhs, const int rhs); friend vector operator * (const vector& lhs, const vector& rhs); friend int operator == (const vector& lhs, const vector& rhs); friend int operator != (const vector& lhs, const vector& rhs); friend ostream& operator << (ostream& out, const vector& rhs); friend istream& operator >> (istream& out, vector& rhs); }; /* Default Constructor */ vector::vector() { dir = 0.0; // Set vector direction to NULL mag = 0.0; // Set vector magnitude to NULL } /* Copy Constructor */ vector::vector(vector &temp) { dir = temp.dir; // Set vector direction to Temperory vector direction mag = temp.mag; // Set vector mahnitude to Temperory vector magnitude } /* Get horizontal component */ double vector::getX(double ang, double dist) { double ans; ans = sin[ang*(M_PI/180)]*dist; // Horizontal (X) component return ans; } /* Get vertical component */ double vector::getY(double ang, double dist) { double ans; ans = cos[ang*(M_PI/180)]*dist; // Vertical (Y) component return ans; } /* Get the resultant magnitude of 2 vectors */ double vector::resMag(double x, double y) { double ans; ans = sqrt(pow(x,2)+pow(y,2)); return ans; } /* Get the resultant direction of 2 vectors */ double vector::resDir(double x, double y) { double ans; ans = atan(y/x); return ans; } /* Operator + */ vector operator + (const vector& lhs, const vector& rhs) { vector ans; double lhsDir, rhsDir; double lhsMag, rhsMag; double lhsX, rhsX; double lhsY, rhsY; double X, Y; lhsDir = lhs.dir; rhsDir = rhs.dir; lhsMag = lhs.mag; rhsMag = rhs.mag; lhsX = getX(lhsDir, lhsMag); // Get horizontal component of LHS vector rhsX = getX(rhsDir, rhsMag); // Get horizontal component of RHS vector lhsX = getY(lhsDir, lhsMag); // Get vertical component of LHS vector rhsX = getY(rhsDir, rhsMag); // Get vertical component of RHS vector X = lhsX + rhsX; // Total of all horizontal components Y = lhsY + rhsY; // Total od all vertical components ans.mag = resMag(X, Y); ans.dir = resDir(X, Y); return ans; }