oright thanks guys i changed it to the following code and compiles and runs fine. ta
Code:
#include <stdio.h>
#include <string.h>
// This program gets Exposure time and Aperture and outputs the exposure time and the correct Aperture value.
int main (int argc, char**argv)
{
// Mainline Variable Declarations
FILE * output = stdout;
FILE * input = stdin;
double exposure;
char aperture[4];
//prompt user for Exposure time.
fprintf(output,"Please Enter the exposure time in seconds: ");
//input Exposure time.
fscanf(input,"%lf",&exposure) ;
fprintf(output,"Thank you\n");
//prompt user for Aperture .
fprintf(output,"Please Enter the aperture value");
//input Aperture.
fscanf(input,"%s",&aperture) ;
if (strcmp(aperture,"f1.2")==0 || strcmp(aperture,"f1.4")==0 || strcmp(aperture,"f1.8")==0 || strcmp(aperture,"f2")==0 || strcmp(aperture,"f2.8")==0 || strcmp(aperture,"f4")==0 || strcmp(aperture,"f5.6")==0 || strcmp(aperture,"f8")==0 || strcmp(aperture,"f11")==0 || strcmp(aperture,"f16")==0 ||strcmp(aperture,"f22")==0 || strcmp(aperture,"f32")==0)
{
// Output Results
fprintf(output,"--> The Exposure time you entered is: %g\n",exposure);
fprintf(output,"-->The Aperture value you entered is acceptable and is:%s\n",aperture);
}
else
{
fprintf(output,"The aperture you entered was not valid ,the program will exit now \n");
}
}