#include #include #include #define A 4 #define B 2 int main() { char doagain = 'Y'; while (doagain=='Y'|| doagain == 'y') { float a[A]; float w; float x; float y; float z; float fw; float fx; float fy; float fz; float b[2][B]; float m; float n; float o; float p; float im; float in; float io; float ip; int any; printf("press 1 to convert F to C, \n press 2 to convert Inchs to Centimeters, \nor press 3 to convert Degrees to Radians."); scanf("%i",&any); if (any < 1 || any > 3) { printf("error! try again! \n"); } if (any == 1) { /*Changes a given number of celsius to farenhight*/ printf("Enter first celsius value"); scanf("%f",&w); printf("Enter second celsius value"); scanf("%f",&x); printf("Enter third celsius value"); scanf("%f",&y); printf("Enter fourth celsius value"); scanf("%f",&z); fw = ((9.0 / 5.0)*(w + 32)); fx = ((9.0 / 5.0)*(x + 32)); fy = ((9.0 / 5.0)*(y + 32)); fz = ((9.0 / 5.0)*(z + 32)); a[0]=fw; a[1]=fx; a[2]=fy; a[3]=fz; printf("\n\n Celsius to Fahrenheit Array \n a[0]= %.2f, a[1]= %.2f, a[2]%.2f,a[3] %.2f\n\n",a[0],a[1],a[2],a[3]); } if (any == 2) { /*This (probably) turns an entered number of centimeters to inches*/ printf("Enter first value for centimeters"); scanf("%f",&m); printf("Enter second value for centimeters"); scanf("%f",&n); printf("Enter third value for centimeters"); scanf("%f",&o); printf("Enter fourth value for centimeters"); scanf("%f",&p); im = m*2.54; in = n*2.54; io = o*2.54; ip = p*2.54; b[0][0]=im; b[0][1]=in; b[1][0]=io; b[1][1]=ip; printf("\n Cm to Inches Array \nb[0][0]=%.2f,b[0][1]=%.2f\n,b[1][0]=%.2f,b[1][1]=%.2f\n\n",b[0][0],b[0][1],b[1][0],b[1][1]); } if (any == 3) { /*Radiant*/ float h; float i; float j; float k; printf("Enter the first value in degrees"); scanf("%f",&h); printf("Enter the second value in degrees"); scanf("%f",&i); printf("Enter the thind value in degrees"); scanf("%f",&j); printf("Enter the fourth value in degrees"); scanf("%f",&k); float degree[4]; degree[0] = h; degree[1] = i; degree[2] = j; degree[3] = k; float rad[4]; rad[0] = h*(0.0175); rad[1] = i*(0.0175); rad[2] = j*(0.0175); rad[3] = k*(0.0175); float matrix[6][4]; int index = 0; while (index < 4) { matrix[0][index] = sin(rad[index]); matrix[1][index] = cos(rad[index]); matrix[2][index] = tan(rad[index]); matrix[3][index] = asin(matrix[0][index]); matrix[4][index] = acos(matrix[1][index]); matrix[5][index] = atan(matrix[2][index]); index = index+1; } //Matrix has functions stored in columns int row = 0; int col = 0; //////// 6 6 3 3 3 4 4 4 printf("\ndegree radian sin cos tan asin acos atan\n"); while(col < 4) { printf("%.4f %.4f %.2f %.2f %.2f %.3f %.3f %.3f\n",degree[col],rad[col],matrix[0][col],matrix[1][col],matrix[2][col],matrix[3][col],matrix[4][col],matrix[5][col]); col++; } } printf("type Y to doagain or N to quit"); scanf(" %c",&doagain); } return 0; }