I have to do something whereI create a class that models a resistor and then create a main function where it will call on three different resistors using resistor3's addseries function and display values for all three functions. This is all I have. any help?
If this code compiles, then you're not using a proper C++ compiler. In fact, this reminds me a little bit of Objective C. O_o
Problems:
1) No [code] tags.
2) Line 4: class ResistorClass //Not "Class:"
3) Clear the +es and -es. I'm guessing that a + was meant to symbolize a public member and a - a private member. I suppose I could do the work for you on this as long as you read the comments. :)
1 2 3 4 5 6 7 8 9 10 11 12 13
{
public: //This is how you specify public members. The following elements will be public.
string m_cResistorName;
void DisplayResistor(); //Missed Semicolon. The void is redundant. :)
void EnterResistance (); //Missed Semicolon. The void is redundant.
void AddSeries (ResistorClass Resistor1, ResistorClass Resistor2); //Missed Semicolon.
ResistorClass(); //You need a default constructor to set the values of everything to NULL.
private: //Cancels the previous tag; the following members are private.
double m_dResValue;
double m_dTolerance;
double m_dMinResistance;
double m_dMaxResistance;
}; //Missed semicolon. :P
To write the implementations of your functions, here's a neat little template you can use to write the implementations outside of your class or any other functions.