#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 ;
}
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CiB1c2luZyBuYW1lc3BhY2Ugc3RkOwogCiBpbnQgbWFpbigpCiB7CiAgICAgY29uc3QgZG91YmxlIHllbl90b19ldXJvPTAuMDA3MjE1OwogICAgIGNvbnN0IGRvdWJsZSBldXJvX3RvX2RvbGxhcj0xLjEyOwogICAgIGNoYXIgY3VycmVuY3k9J3MnOwogICAgIGRvdWJsZSB4OwogCiAgICAgd2hpbGUoY3VycmVuY3khPSdxJykKICAgICB7CiAgICAgICAgIGNvdXQgPDwgImVudGVyIGN1cnJlbmN5IGFuZCB1bml0KHkgLCBlLCBvciBkKSI7CiAgICAgICAgIAogICAgICAgICB3aGlsZSAoIChjaW4gPj4geCA+PiBjdXJyZW5jeSkuZmFpbCgpICYmICFjaW4uZW9mKCkpIHsKICAgICAgICAgICAgIGNvdXQgPDwgImludmFsaWQgZm9ybWF0IjsKICAgICAgICAgICAgIGNpbi5jbGVhcigpOyAKICAgICAgICAgfQogICAgICAgICBpZiAoY2luLmVvZigpKQogICAgICAgICAgICAgYnJlYWs7IAogCiAgICAgICAgIHN3aXRjaChjdXJyZW5jeSl7CiAKICAgICAgICAgICAgIGNhc2UgJ3knOgogICAgICAgICAgICAgICAgIGNvdXQgPDwiZXVybzoiPDwgeCp5ZW5fdG9fZXVybzw8IiBkb2xsYXI6Ijw8eCp5ZW5fdG9fZXVybypldXJvX3RvX2RvbGxhcjw8J1xuJzsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ2UnOgogICAgICAgICAgICAgICAgIGNvdXQgPDwieWVuOiI8PCAoeCooMS4wL3llbl90b19ldXJvKSk8PCIgZG9sbGFyOiI8PCh4KmV1cm9fdG9fZG9sbGFyKTw8J1xuJzsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ2QnOgogICAgICAgICAgICAgICAgIGNvdXQgPDwiIHllbjoiPDwgeCooMS4wL3llbl90b19ldXJvKSooMS4wL2V1cm9fdG9fZG9sbGFyKTw8IiBldXJvOiI8PHgqKDEuMC9ldXJvX3RvX2RvbGxhcik8PCdcbic7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdxJzoKICAgICAgICAgICAgICAgICBjdXJyZW5jeT0ncSc7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIGNvdXQgPDwgImludmFsaWQiOwogICAgICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIH0KIAogICAgIH0KIAogCiB9