Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. double pln,usd,eur,kzt;
  7. char answer;
  8. do
  9. {
  10. cout <<"Type 1 to convert PLN to EURO\n""2 to convert EURO to PLN\n""3 to convert PLN to USD\n""4 to convert USD to PLN\n""5 to convert PLN to KZT\n""6 to convert KZT to PLN\n";
  11. char choice;
  12.  
  13. cin>>choice;
  14. cout <<"Your choice is: "<<choice<<endl;
  15. switch (choice)
  16. {
  17. case '1':
  18. cout <<"Enter the amount in PLN: ";
  19. cin>>pln;
  20. eur=pln/4.4025;
  21. cout <<pln<<" PLN = "<<eur<< " EURO";
  22. break;
  23. case '2':
  24. cout <<"Enter the amount in EUR: ";
  25. cin>>eur;
  26. pln=eur*4.4025;
  27. cout <<eur<<" EUR = "<<pln<< "PLN";
  28. break;
  29. case '3':
  30. cout <<"Enter the amount in PLN: ";
  31. cin>>pln;
  32. usd=pln/3.9976;
  33. cout <<pln<<" PLN = "<<usd<< " USD";
  34. break;
  35. case '4':
  36. cout <<"Enter the amount in USD: ";
  37. cin>>usd;
  38. pln=usd*3.9976;
  39. cout<<usd<<" USD = "<<pln<< "PLN";
  40. break;
  41. case '5':
  42. cout <<"Enter the amount in PLN: ";
  43. cin>>pln;
  44. kzt=pln*100.062;
  45. cout<<pln<<" PLN = "<<kzt<< "KZT";
  46. break;
  47. case '6':
  48. cout <<"Enter the amount in KZT: ";
  49. cin>>kzt;
  50. pln=kzt/100;
  51. cout<<kzt<<" KZT = "<<pln<< "PLN";
  52. break;
  53. default:
  54. cout <<"Wrong choice"<<endl;
  55. }
  56. cout <<"\nDo you want to continue?(y/n)";
  57. cin>>answer;
  58. cin.ignore(100,'\n');
  59. }
  60. while (answer=='Y' || answer=='y');
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement