1a14 /* This is my attempt at a conversion program */ /* Copyleft ()) all rights reversed 2002 Overt a conversion utility. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Overt version 004, CL 2002 orintz@hal3000.cx Overt comes with ABSOLUTELY NO WARRANTY. */ #include int main() { int c; while (1) { puts("\n\n\nPlease choose a conversion from the list below.\a\n"); printf("(Lower case for the reverse conversion).\n"); printf("_______________________________________________\n"); printf("A) Inches to Centimeters:\n"); printf("B) Feet to Meters:\n"); printf("C) Miles to Kilometers:\n"); printf("D) MPG to KPL:\n"); printf("E) F to C:\n"); printf("I) Go to the Overt web site.\n"); printf("W) Browse the Internet for more conversions:\n"); printf("X) To exit:\n"); printf("______________________________________________\n"); c = getchar(); switch (c){ case 'A': { float mult1, multot; printf("Enter Inches to convert to Centimeters:"); scanf("%f", &mult1); multot = mult1 * 2.5400; getchar(); printf(" %f * 2.54 = %f\n",mult1, multot); printf("Press Enter to continue"); getchar(); break; } case 'a': { float mult1, multot; printf("Enter Centimeters to convert to Inches:"); scanf("%f", &mult1); multot = mult1 * .3900; getchar(); printf("\n %f * .3900 = %f\n",mult1, multot); printf("Press Enter to continue"); getchar(); break; } case 'B': { float mult1, multot; printf("Enter Feet to convert to Meters:"); scanf("%f", &mult1); multot = mult1 * .3; getchar(); printf("\n %f * .3 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'b': { float mult1, multot; printf("Enter Meters to convert to Feet:"); scanf("%f", &mult1); multot = mult1 * 3.28; getchar(); printf("\n %f * 3.28 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'C': { float mult1, multot; printf("Enter Miles to convert to Kilometers:"); scanf("%f", &mult1); multot = mult1 * 1.61; getchar(); printf("\n %f * 1.61 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'c': { float mult1, multot; printf("Enter Kilometers to convert Miles:"); scanf("%f", &mult1); multot = mult1 * .62; getchar(); printf("\n %f * .62 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'D': { float mult1, multot; printf("Enter MPG to convert to KPL:"); scanf("%f", &mult1); multot = mult1 * .42; getchar(); printf("\n %f * .42 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'd': { float mult1, multot; printf("Enter KPL to convert to MPG:"); scanf("%f", &mult1); multot = mult1 * 2.39; getchar(); printf("\n %f * 2.39 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'E': { float mult1, multot; printf("Enter temp in F to convert to C:"); scanf("%f", &mult1); multot = .5556 * (mult1 - 32); getchar(); printf("\n .5556 * %f - 32 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'e': { float mult1, multot; printf("Enter temp in C to convert to F:"); scanf("%f", &mult1); multot = (1.8 * mult1) +32; getchar(); printf("\n 1.8 * %f + 32 = %f\n",mult1, multot); printf("Press Enter to continue "); getchar(); break; } case 'I': { printf("Go to the Overt web site.\a\n"); system ("lynx http://www.hal3000.cx/~overt/\n"); getchar(); printf("Press Enter to continue "); getchar(); break; } case 'i': { printf("Go to the Overt web site.\a\n"); system ("lynx http://www.hal3000.cx/~overt/\n"); getchar(); printf("Press Enter to continue "); getchar(); break; } case 'W': { printf("Browse the internet for more conversions:\a\n"); system ("lynx http://www.teaching-english-in-japan.net/conversion/\n"); getchar(); printf("Press Enter to continue "); getchar(); break; } case 'w': { printf("Browse the internet for more conversions:\a\n"); system ("lynx http://www.teaching-english-in-japan.net/conversion/\n"); getchar(); printf("Press Enter to continue "); getchar(); break; } case 'X': printf("Goodbye!\n"); return 0; case 'x': printf("Goodbye!\n"); return 0; continue; } } } 0