Advertisement
Guest User

cuurencyConverter

a guest
Mar 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. // tryingInterface.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #define _USE_MATH_DEFINES
  7. #include <math.h>
  8. #include <iomanip>
  9. #include <string>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. float inputMoney;
  16. string enterCurrency, exitCurrency;
  17.  
  18. float enterCu = 0;
  19. float exitCu = 0;
  20.  
  21. float result = 0;
  22.  
  23. cin >> inputMoney >> enterCurrency >> exitCurrency;
  24.  
  25. if (enterCurrency == "BGN")
  26. {
  27. enterCu = 1;
  28. }
  29. else if (enterCurrency == "USD" )
  30. {
  31. enterCu = 1.79549;
  32. }
  33. else if (enterCurrency == "EUR")
  34. {
  35. enterCu = 1.95583;
  36. }
  37. else if (enterCurrency == "GBP")
  38. {
  39. enterCu = 2.53405;
  40. }
  41.  
  42.  
  43.  
  44. if (exitCurrency == "BGN")
  45. {
  46. exitCu = 1;
  47. }
  48. else if (exitCurrency == "USD")
  49. {
  50. exitCu = 1.79549;
  51. }
  52. else if (exitCurrency == "EUR")
  53. {
  54. exitCu = 1.95583;
  55. }
  56. else if (exitCurrency == "GBP")
  57. {
  58. exitCu = 2.53405;
  59. }
  60.  
  61.  
  62. result = inputMoney * enterCu / exitCu;
  63.  
  64. cout << fixed << setprecision(2) << result <<" "<< exitCurrency << endl;;
  65.  
  66.  
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement