Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. float sumInEuros, numberOfPrices, answer;
  10. void processAPrice();
  11. void produceFinalData();
  12.  
  13.  
  14. numberOfPrices = 0;
  15. sumInEuros = 0;
  16. answer = 'Y';
  17. while (answer = 'Y')
  18. {
  19. processAPrice(sumInEuros);
  20. numberOfPrices = (numberOfPrices +1);
  21. cout << ("Continue (Y/N)?");
  22. cin >> answer;
  23. }
  24.  
  25. produceFinalData(float sumInEuros, numberOfPrices);
  26. }
  27.  
  28. void processAPrice(float sum)
  29. {
  30. float priceInPounds, priceInEuros;
  31. void getPriceInPounds();
  32. void convertPriceIntoEuros();
  33. void showPriceInEuros();
  34. void calculateSum();
  35.  
  36. getPriceInPounds(priceInPounds);
  37. convertPriceIntoEuros(priceInPounds, priceInEuros);
  38. showPriceInEuros(priceInPounds, priceInEuros);
  39. calculateSum(priceInEuros, sum);
  40. }
  41.  
  42. void getPriceInPounds(float inPounds)
  43. {
  44. cout << ("Enter a price in pounds: £");
  45. cin >> inPounds;
  46. }
  47.  
  48. void convertPriceIntoEuros(float pInPounds, float pInEuros)
  49. {
  50. const float conversionRate = 0.93;
  51.  
  52. pInEuros = (pInPounds / conversionRate);
  53. }
  54.  
  55. void showPriceInEuros(float inPounds, float inEuros)
  56. {
  57. cout << ("The euro value of £ ") << inPounds << (" is € ") << inEuros;
  58. }
  59.  
  60. void calculateSum(pE, sE)
  61. {
  62. sE = (sE + pE)
  63. }
  64.  
  65. void produceFinalData( float sumOfPrices, float numOfPrices)
  66. {
  67. cout << ("The total sum is: ") << sumOfPrices << (" €");
  68. cout << ("The average is: ") << (sumOfPrices / numOfPrices);
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement