rainman6682

统计

最新评论

2006年4月15日 #

大家看看我做的简易汇率兑换应用程序(初学)请指教~

#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
double dollars;
double euros;
double yen;
double pesos;


cout <<"\nEnter dollars to convert:";
cin  >>dollars;

cout <<"\nEnter Dollars to Euros:";
cin  >>euros;

cout <<"Dollars to Yen:";
cin  >>yen;

cout <<"Dollars to Prsos:";
cin  >>pesos;


cout <<"\nSelect conversion type:";
cout <<"1 - Dollars to Euros";
cout <<"2 - Dollars to Yen";
cout <<"3 - Dollars to Pesos";

cout <<"?"
cin  >>dollars

double converted;


if(response==1)
{
converted=euros*dollars;
}
else if(response==2)
{
converted=yen*dollars;
}
else if(response==3)
{
converted=pesos*dollars;
}

cout << fixed << setprecision(2);

cout <<"\nConverted amount:$"<<converted<<endl<<endl;

return 0;
}

posted @ 2006-04-15 16:56 李峰 阅读(301) | 评论 (2)编辑 收藏

仅列出标题