Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 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. char Q;
  24. double a = 0;
  25.  
  26. cin >> A >> B >> a;
  27. while (A != Q && B != Q)
  28. {
  29.  
  30. if (A == 'C')
  31. {
  32. cout << CF (a) << endl;
  33. }
  34. if else (A == 'F')
  35. {
  36. cout << FC (a) << endl;
  37. }
  38. if else (A == 'M')
  39. {
  40. cout << MY (a) << endl;
  41. }
  42. if else (A == 'Y')
  43. {
  44. cout << YM (a) << endl;
  45. }
  46. if else (A == 'K')
  47. {
  48. cout << KP (a) << endl;
  49. }
  50. if else (A == 'P')
  51. {
  52. cout << PK (a) << endl;
  53. }
  54. else
  55. {
  56. cout << "Illegal Input" << endl;
  57. }
  58.  
  59. }
  60. return 0;
  61.  
  62. }
  63.  
  64. double CF (double a)
  65. {
  66. double farenheit = 0;
  67. farenheit = a * (1.8) + 32;
  68.  
  69. return farenheit;
  70. }
  71.  
  72. double FC (double a)
  73. {
  74. double celcius = 0;
  75. celcius = (a - 32) * (0.6);
  76.  
  77. return celcius;
  78. }
  79.  
  80. double MY (double a)
  81. {
  82. double yards = 0;
  83. yards = 0.9144 * a;
  84.  
  85. return yards;
  86. }
  87.  
  88. double YM (double a)
  89. {
  90. double meters = 0;
  91. meters = 1.09361 * a;
  92.  
  93. return meters;
  94. }
  95.  
  96. double KP (double a)
  97. {
  98. double pounds = 0;
  99. pounds = 2.20462 * a;
  100.  
  101. return pounds;
  102. }
  103.  
  104. double PK (double a)
  105. {
  106. double kilograms = 0;
  107. kilograms = 2.20462 * a;
  108.  
  109. return kilograms;
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement