└── README.md /README.md: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | char category; 5 | int tempChoice; 6 | int currencyChoice; 7 | int massChoice; 8 | int userinputF; ; 9 | int userinputC; 10 | int userinputUSDtoEuro; 11 | int userinputUSDtoJPY; 12 | int userinputUSDtoRMB; 13 | int userinputOunce; 14 | int userinputGram; 15 | int fahrenheitToCelcius; 16 | int celciusToFahrenheit; 17 | float USDtoEURO ; 18 | float USDtoJPY; 19 | float USDtoRMB; 20 | float ounceToPounds; 21 | float gramsToPounds; 22 | 23 | printf("Welcome to Unit Converter! \n"); 24 | printf("Here is a list of conversation to choose from: \n"); 25 | printf("Temperature(T),Currency(C),Mass(M) \n"); 26 | printf("Please enter the letter you want to convert.\n"); 27 | scanf("%c",&category); 28 | 29 | if(category == 'T'){ 30 | printf("Welcome to Temperature Converter! \n"); 31 | printf("Here is a list of conversations to choose from: \n"); 32 | printf("Enter 1 for Fahrenheit to Celsius. \n"); 33 | printf("Enter 2 for Celsius to Fahrenheit. \n"); 34 | scanf("%d",&tempChoice); 35 | if(tempChoice == 1){ 36 | printf("Please enter the Fahrenheit degree: \n"); 37 | scanf("%d",&userinputF); 38 | fahrenheitToCelcius = ((userinputF-32) * (5.0/9.0)); 39 | printf("Celcius: %d",fahrenheitToCelcius); 40 | } 41 | else if(tempChoice == 2){ 42 | printf("Please enter the Celcius degree: \n"); 43 | scanf("%d",&userinputC); 44 | celciusToFahrenheit = ((9.0/5.0)*userinputC + 32); 45 | printf("Fahrenheit: %d",celciusToFahrenheit); 46 | } 47 | else 48 | printf("Please enter the correct choice. \n"); 49 | } 50 | 51 | else if(category == 'C') { 52 | printf("Welcome to Currency Converter! \n"); 53 | printf("Here is a list of conversations to choose from: \n"); 54 | printf("Enter 1 for USD to Euro. \n"); 55 | printf("Enter 2 for USD to JPY. \n"); 56 | printf("Enter 3 for USD to RMB. \n"); 57 | scanf("%d",¤cyChoice); 58 | if(currencyChoice == 1){ 59 | printf("Please enter the USD amount: \n"); 60 | scanf("%d",&userinputUSDtoEuro); 61 | USDtoEURO = userinputUSDtoEuro * 0.87; 62 | printf("Euro: %.2f",USDtoEURO); // %.2f = rounds the float to only 2 decimal places; 63 | } 64 | else if(currencyChoice == 2){ 65 | printf("Please enter the USD amount: \n"); 66 | scanf("%d",&userinputUSDtoJPY); 67 | USDtoJPY = userinputUSDtoJPY * 111.09; 68 | printf("JPY: %.2f",USDtoJPY); 69 | } 70 | else if(currencyChoice == 3) { 71 | printf("Please enter the USD amount: \n"); 72 | scanf("%d",&userinputUSDtoRMB); 73 | USDtoRMB = userinputUSDtoRMB * 6.82; 74 | printf("RMB: %.2f",USDtoRMB); 75 | } 76 | else 77 | printf("Please enter correct choice. \n"); 78 | } 79 | else if(category == 'M'){ 80 | printf("Welcome to Mass Converter! \n"); 81 | printf("Here is a list of conversations to choose from: \n"); 82 | printf("Enter 1 for ounces to pounds. \n"); 83 | printf("Enter 2 for gram to pounds. \n"); 84 | scanf("%d",&massChoice); 85 | if(massChoice == 1){ 86 | printf("Please enter the ounce amount: \n"); 87 | scanf("%d",&userinputOunce); 88 | ounceToPounds = userinputOunce * 0.0625; 89 | printf("Pounds: %.2f",ounceToPounds); 90 | } 91 | else if(massChoice == 2) { 92 | printf("Please enter the gram amount: \n"); 93 | scanf("%d",&userinputGram); 94 | gramsToPounds = userinputGram * 0.00220462; 95 | printf("Pounds: %.2f",gramsToPounds); 96 | } 97 | else 98 | printf("Please enter the correct choice. \n"); 99 | } 100 | return 0; 101 | } 102 | --------------------------------------------------------------------------------