/*
Génesis M Ojeda Rosa
COMP 3800
lenguaje COMP
Conversión de dólares a pesos colombianos, yen y euros.
*/
//imports library
#include <stdio.h>
//defines constants
#define COLOMBIAN_DOLLARS 4215
#define EUROS 0.93
#define YEN 143.86
int main() {
double us_dollars, colombian_dollars, euros, yen;
int choice;
// Display the menu of convertion
printf("Currency Converter Menu:\n");
printf("1. Convert to Colombian Pesos\n");
printf("2. Convert to Euros\n");
printf("3. Convert to Yen\n");
printf("Enter your choice: ");
scanf("%d", &choice);
if (choice > 0 && choice < 4) {
// Asks for the amount
printf("Enter USD amount to convert: ");
scanf("%lf", &us_dollars);
// Perform the conversion based on the choice
if (choice == 1) {
colombian_dollars = COLOMBIAN_DOLLARS * us_dollars;
printf("%.2f USD is %.2f Colombian Pesos.\n", us_dollars, colombian_dollars);
} else if (choice == 2) {
euros = EUROS * us_dollars;
printf("%.2f USD is %.2f Euros.\n", us_dollars, euros);
} else {
yen = YEN * us_dollars;
printf("%.2f USD is %.2f Yen.\n", us_dollars, yen);
}
}
else {
printf("Please enter a choice from the menu.\n");
}
return 0;
}