Ok this shouldn't take too long to fix, simple program for working out resistance and voltage for some amplifier...
Code:
#include <stdio.h>
#define Vc (5.5);
#define Ve (1.1);
#define Vin (0.075); /* Voltages */
#define Hfe (100);
int main(void)
{
float Vout, R1, R2, R3, R4;
float Ic, Vcc;
float Ib, Vb, Ks;
/* Enter the current, from 2e-3 to 5e-3 */
printf("Enter Ic: ");
scanf("%f", &Ic);
/* Enter the voltage, 9.0, 10.0 or 12.0 */
printf("Enter Vcc: ");
scanf("%f", &Vcc);
Ib = Ic / Hfe;
R1 = (Vcc - Vc) / (Ic);
R2 = (Ve / Ic + Ib) ;
Vb = 0.7 + Ve;
R3 = (Vcc - Vb)/ (6 * Ib);
R4 = Vb / (5 * Ib);
Ks= R1/R2;
Vout = Ks * Vin;
printf("**********************\n");
printf("R1= %6.0f Ohms \n", R1);
printf("R2= %6.0f Ohms \n", R2);
printf("R3= %6.0f Ohms \n", R3);
printf("R4= %6.0f Ohms \n", R4);
printf("Vout= %3.1f V \n", Vout);
return(0);
}
Ok, the green lines are the ones I'm having trouble with, the compiler says "error: expected ')' before ';' token" for both the lines
And also for the red lines, if I swap them around like so
Code:
Vb = Ve + 0.7
Vout = Vin * Ks
The compiler says "Warning: statement with no effect" and "error: invalid type of 'unary *' " respectively. But if I have them the way I do as above, it works fine.