when I try to compile in Devc++, i\'m getting an error in theconstructor of the
ID: 3615077 • Letter: W
Question
when I try to compile in Devc++, i'm getting an error in theconstructor of the amplifier class, do you know how to fix it?#include <iostream>
using namespace std;
class Circuit
{
public:
float Resistance,InputVoltage, Current;
Circuit(float r1, floatv1, float i1)
{
Resistance = r1;
InputVoltage = v1;
Current = i1;
cout << "It is called:" << endl;
}
floatReturnCurrent()
{
Current = InputVoltage/Resistance;
return Current;
}
void DisplayValues()
{
cout << " Resistance = " << Resistance <<endl;
cout << " Input Voltage = " << InputVoltage <<endl;
cout << " Current = " << Current << endl;
}
};
class Amplifier : public Circuit
{
public:
float Gain;
Amplifier(float r1,float v1, float i1, float G)
{
Resistance = r1;
InputVoltage = v1;
Current = i1;
Gain = G;
}
float ReturnGain()
{
return Gain;
}
floatReturnOutputVoltage()
{
return Gain*InputVoltage;
}
};
int main()
{
Amplifier A(10, 2, 4, 2);
A.ReturnGain;
A.ReturnOutputVoltage;
system ("PAUSE");
return 0;
}
Explanation / Answer
//Hope this will helpyou. #include using namespace std; class Circuit { public: float Resistance,InputVoltage, Current; Circuit(float r1, floatv1, float i1) { Resistance = r1; InputVoltage = v1; Current = i1; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.