返回首页

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

	int number1 = 0;

	double total = 0.0;

	char currency = ' ';

 

	cout << "Enter amount of us dollars: ";

	cin >> number1;

 

	cout << "What currency would you like to convert it to?" << endl;

	

	cout << "Canada Dollar (CD)" << endl;

	cout << "Eurozone Euro (EE)" << endl;

	cout << "India Rupee (IR)" << endl;

	cout << "Japan Yen (JY)" << endl;

	cout << "Mexico Peso (MP)" << endl;

	cout << "South Africa Rand (SAR)" << endl;

	cout << "United Kingdom Pound (UKP)" << endl;

	

	cout << "Choose currency by the letter(s) in the parentheses: ";

	cin >> currency;

 

	if  (currency == 'CD')

		total = 1.01615 * number1;

	else if (toupper (currency == 'EE'))

		total = .638490 * number1;

	else if (toupper (currency == 'IR'))

		total = 40.1798 * number1;

	else if (toupper (currency == 'JY'))

		total = 104.390 * number1;

	else if (toupper (currency == 'MP'))

		total = 10.4613 * number1;

	else if (toupper (currency == 'SAR'))

		total = 7.60310 * number1;

	else if (toupper (currency == 'UKP'))	

		total = .504285 * number1;

 

	cout << "Currency converted: " << total << endl;

	

 

	system("pause");

	return 0;

}
扎克・冈萨雷斯

回答

评论会员: 时间:2
I