#include<iostream>
 using namespace std;
 
 int main()
 {
     const double yen_to_euro=0.007215;
     const double euro_to_dollar=1.12;
     char currency='s';
     double x;
 
     while(currency!='q')
     {
         cout << "enter currency and unit(y , e, or d)";
         
         while ( (cin >> x >> currency).fail() && !cin.eof()) {
             cout << "invalid format";
             cin.clear(); 
         }
         if (cin.eof())
             break; 
 
         switch(currency){
 
             case 'y':
                 cout <<"euro:"<< x*yen_to_euro<<" dollar:"<<x*yen_to_euro*euro_to_dollar<<'\n';
                 break;
             case 'e':
                 cout <<"yen:"<< (x*(1.0/yen_to_euro))<<" dollar:"<<(x*euro_to_dollar)<<'\n';
                 break;
             case 'd':
                 cout <<" yen:"<< x*(1.0/yen_to_euro)*(1.0/euro_to_dollar)<<" euro:"<<x*(1.0/euro_to_dollar)<<'\n';
                 break;
             case 'q':
                 currency='q';
                 break;
             default:
                 cout << "invalid";
                 break;
 
         }
 
     }
 
 
 }