RC Filter Please Help!!!

1
2
3
4
5
6
7
8
9
10
11
void Filter::getResistor()
{
     double res;
     double tol;
     cout<<endl<<"Enter resistor's resistance:  ";
     cin>>res;
     cout<<endl<<"Enter resistor tolerance : ";
     cin>>tol;
     resistor.setResistance(res);
     resistor.setResTolerance(tol);
}

*************************Compiler Errors**********************************
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.cpp(27): error C2065: 'resistor' : undeclared identifier
1>c:\users\lauren\documents\visual studio 2010\projects\composition\composition\filter.cpp(27): error C2228: left of '.setResistance' must have class/struct/union
1> type is ''unknown-type''

***************************************************************************
I have a Resistor.h, Capacitor.h, and a Filter.h file mad already. As well as resistor, capacitor, and filter.cpp files. All of my errors state that resistor is a undeclared identifier and setResistance must have a class.
I don't see you declare an object "resistor" anywhere. That would look something like:
MyResistorClass resistor;
Depending on what this function is supposed to do, however, your program might not work as intended.
I have resistor defined in my Resistor.h file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//Resistor.h
//Programmer: Wendell Riggins
//08/05/2012
 
#pragma
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

//The Class Declaration

class Resistor
{
	
private:
	double m_dResValue;
	double m_dTolerance;
	double m_dMinRResistance;
	double m_dMaxResistance;
public:
	Resistor();
	Resistor(string Name, double resistorValue, double resistorTolerance);
	Resistor(const Resistor &resistorObject);
	string m_cResistorName;
	void DisplayResistor(void);
	void EnterResistance (void);
	// Returns minimum  tolerance resistance
	double getMinResistance(void);
	// Returns maximum tolerance resistance
	double getMaxResistance(void);
	// Returns resistor tolerance
	double getResTolerance(void);
};
Topic archived. No new replies allowed.