0
How to write a program using C for currency converter?
Like rupee to dollar, pounds, yen, euro and vice versa.
2 Réponses
0
just simply take an integer of float variable as an input and the just multiply it by a number that is equivalent to the original one.
For example 1 dollar ≈ 64 INR
So when you just need to multiply the original value to (1/64.0) And same applies for the rest.
- 1
#define YOUR_CURRENCY DOLLAR_EXCHANGE_RATE
money_t euro_to_yen(money_t amount)
{
return amount * YEN / EURO;
}
#undef YOUR_CURRENCY