Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // Skilaverkefni1
  4. //
  5. // Created by Gunnhildur Omarsdottir on 31/08/14.
  6. // Copyright (c) 2014 Gunnhildur Omarsdottir. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. using namespace std;
  11.  
  12. double CF (double a);
  13. double FC (double a);
  14. double MY (double a);
  15. double YM (double a);
  16. double KP (double a);
  17. double PK (double a);
  18.  
  19. int main()
  20. {
  21. char A;
  22. char B;
  23. double a = 0;
  24.  
  25. cin >> A >> B >> a;
  26. while (A != 'Q' && B != 'Q')
  27. {
  28.  
  29. if (A == 'C')
  30. {
  31. cout << CF (a) << endl;
  32. }
  33. if else (A == 'F')
  34. {
  35. cout << FC (a) << endl;
  36. }
  37. if else (A == 'M')
  38. {
  39. cout << MY (a) << endl;
  40. }
  41. if else (A == 'Y')
  42. {
  43. cout << YM (a) << endl;
  44. }
  45. if else (A == 'K')
  46. {
  47. cout << KP (a) << endl;
  48. }
  49. if else (A == 'P')
  50. {
  51. cout << PK (a) << endl;
  52. }
  53. else
  54. {
  55. cout << "Illegal Input" << endl;
  56. }
  57.  
  58. }
  59. return 0;
  60.  
  61. }
  62.  
  63. double CF (double a)
  64. {
  65. double farenheit = 0;
  66. farenheit = a * (1.8) + 32;
  67.  
  68. return farenheit;
  69. }
  70.  
  71. double FC (double a)
  72. {
  73. double celcius = 0;
  74. celcius = (a - 32) * (0.6);
  75.  
  76. return celcius;
  77. }
  78.  
  79. double MY (double a)
  80. {
  81. double yards = 0;
  82. yards = 0.9144 * a;
  83.  
  84. return yards;
  85. }
  86.  
  87. double YM (double a)
  88. {
  89. double meters = 0;
  90. meters = 1.09361 * a;
  91.  
  92. return meters;
  93. }
  94.  
  95. double KP (double a)
  96. {
  97. double pounds = 0;
  98. pounds = 2.20462 * a;
  99.  
  100. return pounds;
  101. }
  102.  
  103. double PK (double a)
  104. {
  105. double kilograms = 0;
  106. kilograms = 2.20462 * a;
  107.  
  108. return kilograms;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement