Hello I wrote this program it's meant to take the final value of the soconday voltage or the secondary current and send the final value to a file saved in the the c: drive called test. The program excutes well but when i go back to see if the values are in the file it's not there. I was hoping Someone could fix my code and point out the mistakes. I would be highly obliged is someone takes 5 mins of thir time to do so.
Code:
#include <stdio.h>
int main()
{
float voltageP,voltageS,currentP,currentS,N1,N2,i;
FILE *inp, *outp;
printf(" If you want to calculate in terms of voltage enter 1 for current enter any other number: ");
scanf("%f",&i);
if (i==1) {
printf("What is the primary voltage: ");
scanf("%f",&voltageP);
printf("How many turns in the primary coil: ");
scanf("%f",&N1);
printf("How many turns in the secondary coil: ");
scanf("%f",&N2);
voltageS=voltageP*N2/N1;
printf("The secondary voltage is equal to %f volts\n",voltageS);
inp =fopen("c:test.txt", "w");
}
else {
printf("What is the primary current: ");
scanf("%f",¤tP);
printf("How many turns in the primary coil: ");
scanf("%f",&N1);
printf("How many turns in the secondary coil: ");
scanf("%f",&N2);
currentS=currentP*N2/N1;
printf("The secondary current is equal to %f amps\n",currentS);
inp =fopen("c:test.txt", "w");
}
return 0;
}