Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<conio.h>
- void mainMenu();
- void feetMile();
- void mileFeet();
- void inchFoot();
- void footInch();
- void celFah();
- void fahCel();
- void feetMile(){
- system("cls");
- float feet, mile;
- printf("\n\t\tENTER FEET: ");
- scanf("%f", &feet);
- //COMPUTATION
- mile = feet / 5820;
- printf("\n\t\t%f FEET is equal to %f MILE", feet, mile);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void mileFeet(){
- system("cls");
- float feet, mile;
- printf("\n\t\tENTER MILE: ");
- scanf("%f", &mile);
- //COMPUTATION
- feet = mile * 5820;
- printf("\n\t\t%f MILE is equal to %f FEET", mile, feet);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void inchFoot(){
- system("cls");
- float inch, foot;
- printf("\n\t\tENTER INCH: ");
- scanf("%f", &inch);
- //COMPUTATION
- foot = inch / 12;
- printf("\n\t\t%f INCH is equal to %f FOOT", inch, foot);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void footInch(){
- system("cls");
- float inch, foot;
- printf("\n\t\tENTER FOOT: ");
- scanf("%f", &foot);
- //COMPUTATION
- inch = foot * 12;
- printf("\n\t\t%f FOOT is equal to %f INCH", foot, inch);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void celFah(){
- system("cls");
- float cel, fah;
- printf("\n\t\tENTER CELSIUS: ");
- scanf("%f", &cel);
- //COMPUTATION
- fah = (cel * 1.8) + 32;
- printf("\n\t\t%f CELSIUS is equal to %f FAHRENHEIT", cel, fah);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void fahCel(){
- system("cls");
- float cel, fah;
- printf("\n\t\tENTER FAHRENHEIT: ");
- scanf("%f", &fah);
- //COMPUTATION
- cel = (fah - 32) * .5556;
- printf("\n\t\t%f FAHRENHEIT is equal to %f CELSIUS", fah, cel);
- printf("\n\t\tPress any key to go back to Main Menu...");
- getch();
- mainMenu();
- }
- void mainMenu(){
- int choice;
- printf("\n\t\t************************************************");
- printf("\n\t\t INPUT, OUTPUT, AND MATH EXPRESSION STRUCTURES");
- printf("\n\t\t************************************************");
- printf("\n\n\t\t[1]. FEET TO MILE");
- printf("\n\t\t[2]. MILE TO FEET");
- printf("\n\t\t[3]. INCH TO FOOT");
- printf("\n\t\t[4]. FOOT TO INCH");
- printf("\n\t\t[5]. CELSIUS TO FAHRENHEIT");
- printf("\n\t\t[6]. FAHRENHEIT TO CELSIUS");
- printf("\n\t\t[7]. EXIT");
- printf("\n\n\t\tENTER CHOICE: ");
- scanf("%d", &choice);
- switch(choice){
- case 1:
- feetMile();
- break;
- case 2:
- mileFeet();
- break;
- case 3:
- inchFoot();
- break;
- case 4:
- footInch();
- break;
- case 5:
- celFah();
- break;
- case 6:
- fahCel();
- break;
- case 7:
- exit(1);
- break;
- default:
- printf("\n\t\tINVALID CHOICE!");
- exit(1);
- }
- }
- int main(){
- mainMenu();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement