Header Ad

C++ program to convert the dollar in different currencies

In this post, we are going to write a C++ program to convert the dollar into different currencies. the first user will choose the currency in which he wants to convert the dollars. and then the user will enter the amount in dollars. and then the program will print the value of the dollar in equivalent currency.

C++ program to convert the dollar in different currencies


C++ program to convert dollars into different currencies.

#include<iostream>
#include<conio.h>

int main()
{

    int n,d;
    float amount;

    std::cout<<"1. Britis Punds "<<std::endl;
    std::cout<<"2. Euro "<<std::endl;
    std::cout<<"3. UAE Dirham "<<std::endl;
    std::cout<<"4. Japanese Yen "<<std::endl;
    std::cout<<"5. Indian Rupees "<<std::endl;
    std::cout<<"Enter the number from the above list = ";
    std::cin>>n;

    switch(n)
    {
        case 1:
        {
            std::cout<<"Enter the dollars = ";
            std::cin >> d;
            amount = 0.82*d;
            std::cout<<"The amount in British Pound = "<<amount;
        }
        break;

        case 2:
        {
            std::cout<<"Enter the dollars = ";
            std::cin>>d;
            amount = 0.95*d;
            std::cout<<"The amount in Euro = "<<amount;
        }
        break;

        case 3:
        {
            std::cout<<"Enter the dollars = ";
            std::cin>>d;
            amount = 3*d;
            std::cout<<"The amount in UAE Dirham = "<<amount;
        }
        break;

        case 4:
        {
            std::cout<<"Enter the dollars = ";
            std::cin>>d;
            amount = 135*d;
            std::cout<<"The amount is Japanese Yen = "<<amount;
        }
        break;

        case 5:
        {
            std::cout<<"Enter the dollars = ";
            std::cin>>d;
            amount = 78*d;
            std::cout<<"The amount in indian Rupees = "<<amount;
        }
        break;
    }

return 0;
}



Output

1. British Pounds
2. Euro
3. UAE Dirham
4. Japanese Yen
5. Indian rupees
Enter the number from the above list = 1
Enter the dollars = 5
The amount in British Pound = 4.08

Post a Comment

0 Comments