Finally got a programme partially working, could anyone advise why the values are not showing? Is this down to incorrect formula or i havent declared the values etc?
Code:
#include <stdio.h>
#include <math.h>
float timeconstant(float R, float C);
float R;
float C;
float time_c;
double const V1 = 0.35;
double const V2 = 0.75;
double const V3 = 0.95;
float cap_c_formula;
float cap_charge1(float R1, float C1, int V1);
float cap_charge2(float R1, float C1, int V2);
float cap_charge3(float R1, float C1, int V3);
int main(void)
{
printf("State a Value For The Resistor?\n");
scanf("%f",&R);
printf("State a Value For The Capacitor?\n");
scanf("%f",&C);
time_c = timeconstant(R,C);
printf("Time to Charge the Capacitor to 35 Percent : %f \n" ,cap_charge1);
printf("Time to Charge the Capacitor to 75 Percent : %f \n" ,cap_charge2);
printf("Time to Charge the Capacitor to 95 Percent : %f \n" ,cap_charge3);
getchar();
getchar();
}
float timeconstant(float R1, float C1)
{
float t_constant;
t_constant = R1*C1;
return t_constant;
}
float cap_charge1(float R1, float C1, int V1)
{
float capc_charge1;
capc_charge1 = -(R1*C1)*log(V1);
}
float cap_charge2(float R1, float C1, int V2)
{
float capc_charge2;
capc_charge2 = -(R1*C1)*log(V2);
}
float cap_charge3(float R1, float C1, int V3)
{
float capc_charge3;
capc_charge3 = -(R1*C1)*log(V3);
}