Question #264783

The following are the assumed existing equivalent currency rates corresponding to the US 

dollar ($1.00); Australia (Aus $), 1.09; Hong Kong (HK $), 7.81; Indonesia (Rupiah), 990.41; 

Japan (Yen), 234.93; Malaysia (Ringgit), 2.34; Philippines (Peso), 13.80. Prepare a program that 

will accept US dollar and currency to be converted as inputs, then compute the equivalent in 

the chosen foreign currency. Print the results. 

(Use if then else statement.) 


Expert's answer

#include <iostream>


using namespace std;


int main()
{
    double dollars;
    cout<<"\nEnter currency dollars: ";
    cin>>dollars;
    
    int c;
    cout<<"\n1. Australia (Aus $)\n2. Hong Kong(HK $)\n3. Indonesia (Rupiah)";
    cout<<"\n4. Japan (Yen) \n5. Malaysia (Ringgit) \n6. Philippines (Peso)";
    cout<<"\nEnter your choice: ";
    cin>>c;
    
    double x;
    if(c==1){
        x=dollars*1.09;
    }
    else if(c==2){
        x=dollars*7.81;
    }
    else if(c==3){
        x=dollars* 990.41;
    }
    else if(c==4){
        x=dollars*234.93;
    }
    else if(c==5){
        x=dollars*2.34;
    }
    else if(c==6){
        x=dollars*13.80;
    }
    
    cout<<"\nEquilvalent = "<<x;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS