### resistor

Hi, I got a program here and it is not making the calculations,I've tried different solutions but they are not working for me, any suggestions??

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273`` ``````#include #include #include // std::advance #include #define VBE 0.7f using namespace std; /****************************************************************************/ float Calcib(float ic, float beta); float Calcrb(float Vcc, float ib); float Calcrc(float Vcc, float ic); /****************************************************************************/ int main(int argc, char** argv) { float ib; float rc; float rb; float Vcc = 0.0; float ic = 0.0; float beta = 0.0; ib = Calcib (ic, beta); rb = Calcrb (Vcc, ib); rc = Calcrc (Vcc, ic); cout << "Please enter the value for Vcc: " ; //prints sentence on screen cin >> Vcc; //value entry cout << "Please enter the value for ic: " ; //prints sentence on screen cin >> ic; //value entry cout << "Please enter a value for beta; " ; //prints sentence on screen cin >> beta; cout<< "*.*.*.*.*.Base Bias.*.*.*.*.*" << endl; cout<< "vcc\t\t "<< Vcc << endl; cout<< "ic \t\t " << ic << endl; cout<< "beta\t\t "<< beta << endl; cout<< "ib\t\t " << ib << endl; cout<< "rb\t\t " << rb << endl; cout<< "rc\t\t " << rc << endl; cout<< "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*" << endl; return 0; } float Calcib(float ic, float beta, float ib) { ib = ic / beta; return ib; } float Calcrb(float Vcc, float ib, float rb) { rb = ceil((Vcc - VBE) / ib); return rb; } float Calcrc(float Vcc, float ic, float rc) { rc = ceil((0.5 * Vcc) / ic); return rc; }``````

Last edited on
For one thing, your function prototypes don't agree with your function definitions.
Your function prototypes take two arguments.
Your function definitions take three arguments.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
for another thing, you do be using the functions before you enter the values for their parameters. Your answers are going to be pure gibberish.
so I changed it to this, but still, I am not getting the right math done, the calculations I mean. And thanks for the hints

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374`` ``````[code] #include #include #include // std::advance #include #define VBE 0.7f using namespace std; /****************************************************************************/ float Calcib(float ic, float beta, float ib); float Calcrb(float Vcc, float ib, float rb); float Calcrc(float Vcc, float ic, float rc); /****************************************************************************/ int main(int argc, char** argv) { float ib; float rc; float rb; float Vcc; float ic; float beta; ib = Calcib(ic, beta, ib); rb = Calcrb(Vcc, ib, rb); rc = Calcrc(Vcc, ic, rc); cout << "Please enter the value for Vcc: " ; //prints sentence on screen cin >> Vcc; //value entry cout << "Please enter the value for ic: " ; //prints sentence on screen cin >> ic; //value entry cout << "Please enter a value for beta; " ; //prints sentence on screen cin >> beta; cout<< "*.*.*.*.*.Base Bias.*.*.*.*.*" << endl; cout<< "vcc\t\t "<< Vcc << endl; cout<< "ic \t\t " << ic << endl; cout<< "beta\t\t "<< beta << endl; cout<< "ib\t\t " << ib << endl; cout<< "rb\t\t " << rb << endl; cout<< "rc\t\t " << rc << endl; cout<< "*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*" << endl; return 0; } float Calcib(float ic, float beta, float ib) { ib = (ic / beta); return ib; } float Calcrb(float Vcc, float ib, float rb) { rb = ceil((Vcc - VBE) / ib); return rb; } float Calcrc(float Vcc, float ic, float rc) { rc = ceil((0.5 * Vcc) / ic); return rc; }``````
[/code]
Last edited on
Line 25: ic is an uninitialized variable.

Line 28: What value of ic do you think you're passing to the function?

Ditto for beta and Vcc.