#include <stdio.h> /* give access to the stdio.h library */
#define Vc 6.5 /*Vc = 6.5v*/
#define Ve 1.3 /*Ve = 1.3v*/
#define Ic 3*10^(-3) /*Ic = 3*10^(-3)A*/
#define Hfe 100
int main(void)
{
float Vcc;
float Vin;
float R1;
float R2;
float R3;
float R4;
float Vout;
float Ib;
float Ks;
float Vb;
printf("Enter Vin: "); /*Enter the input voltage in volts. 0.01 - 0.05*/
scanf("%f", &Vin);
printf("Enter Vcc: "); /*Input of Vcc in volts. 9.0, 10.0 or 12.0*/
scanf("%f", &Vcc);
Ib = Ic/Hfe; /*Calculates Ib*/
R1 = (Vcc -Vc)/Ic; /*Calculates R1*/
R2 = Ve /(Ic + Ib); /*Calculates R2*/
Vb = Ve+0.7; /*Calculates Vb*/
R4 = Vb/(5+Ib); /*Calculates R4*/
R3 = (Vcc-Vb)/(6*Ib); /*Calculates R3*/
Ks = R1/R2; /*Calculates Ks*/
Vout = Vin*Ks; /*Calculates Vout*/
printf("Resistors: \n");
printf(" R1 = %.f ohm \n" , R1);
printf(" R2 = %.f ohm \n" , R2);
printf(" R3 = %.f ohm \n" , R3);
printf(" R4 = %.f ohm \n" , R4);
printf("Output voltage: \n");
printf(" Vout = %.1f v \n" , Vout);
return 0;
}
I keep getting the error message "error: invalid operands to binary^". I've tried changing around floats and rearranging the equations with no success. I tried looking up the error code, but there was nothing useful that i could find on any forums or alike.
Any help is greatly appreciated

New Topic/Question
Reply



MultiQuote



|