Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. float gr = pow(10, -11);
  10. float xr = pow(10, -8);
  11. float uv = 4e-007;
  12. float vl = 7e-007;
  13. float ir = pow(10, -3);
  14. float mw = pow(10, -2);
  15. float num1, num2, num3;
  16. string grs = " meter is a Gamma Ray";
  17. string xrs = " meter is a X ray";
  18. string uvs = " meter is a Ultra Violet";
  19. string vls = " meter is a Visible Light";
  20. string irs = " meter is a Infrared";
  21. string mws = " meter is a Microwaves";
  22. cout << "enter the wavelengths of three different electromagnetic waves in meters: " << endl;
  23. cin >> num1;
  24. cin >> num2;
  25. cin >> num3;
  26. string num1String = "The first electromagnetic wave with a wavelength of meter is a ";
  27.  
  28. //FOR NUM 1
  29.  
  30. if (num1 < gr)
  31. {
  32. cout << num1String << num1 << grs << endl;
  33. }
  34. if (num1 > gr && num1 < xr)
  35. {
  36. cout << num1String << num1 << xrs <<endl;
  37. }
  38. if (num1 > xr && num1 < uv)
  39. {
  40. cout << num1String << num1 << uvs <<endl;
  41. }
  42. if (num1 > uv && num1 < vl)
  43. {
  44. cout << num1String << num1 << vls <<endl;
  45. }
  46. if (num1 > vl && num1 < ir)
  47. {
  48. cout << num1String << num1 << irs <<endl;
  49. }
  50. if (num1 > ir && num1 < mw)
  51. {
  52. cout << num1String << num1 << mws <<endl;
  53. }
  54. if (num1 > mw)
  55. {
  56. cout << num1String << num1 << " meter is a Radio Waves" <<endl;
  57. }
  58.  
  59. //for num 2
  60. if (num2 < gr)
  61. {
  62. cout << num1String << num2 << grs << endl;
  63. }
  64. if (num2 > gr && num2 < xr)
  65. {
  66. cout << num1String << num2 << xrs << endl;
  67. }
  68. if (num2 > xr && num2 < uv)
  69. {
  70. cout << num1String << num2 << uvs << endl;
  71. }
  72. if (num2 > uv && num2 < vl)
  73. {
  74. cout << num1String << num2 << vls << endl;
  75. }
  76. if (num2 > vl && num2 < ir)
  77. {
  78. cout << num1String << num2 << irs << endl;
  79. }
  80. if (num2 > ir && num2 < mw)
  81. {
  82. cout << num1String << num2 << mws << endl;
  83. }
  84. if (num2 > mw)
  85. {
  86. cout << num1String << num2 << " meter is a Radio Waves" << endl;
  87.  
  88. }
  89.  
  90. //FOR NUM 3
  91.  
  92. if (num3 < gr)
  93. {
  94. cout << num1String << num3 << grs << endl;
  95. }
  96. if (num3 > gr && num3 < xr)
  97. {
  98. cout << num1String << num3 << xrs <<endl;
  99. }
  100. if (num3 > xr && num3 < uv)
  101. {
  102. cout << num1String << num3 << uvs <<endl;
  103. }
  104. if (num3 > uv && num3 < vl)
  105. {
  106. cout << num1String << num3 << vls <<endl;
  107. }
  108. if (num3 > vl && num3 < ir)
  109. {
  110. cout << num1String << num3 << irs <<endl;
  111. }
  112. if (num3 > ir && num3 < mw)
  113. {
  114. cout << num1String << num3 << mws <<endl;
  115. }
  116. if (num3 > mw)
  117. {
  118. cout << num1String << " meter is a Radio Waves" <<endl;
  119. printf ("%.3f", num3);
  120. }
  121. return 0;
  122.  
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement