Advertisement
Guest User

Code

a guest
Sep 28th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. double frequency, wavelength;
  7. char choice;
  8. cout <<"Do you want to input Frequency 'f' or Wavelength 'w' ?" << endl;
  9. cin >> choice;
  10. switch (choice)
  11. {
  12. case 'f':
  13. cout << "input frequency /n";
  14. cin >> frequency;
  15.  
  16. if (Frequency <= 0.000000003)
  17. cout <<"This is a Radio wave, it has a wavelength of over one nanometer";
  18. else if (Frequency >= 3000000000)
  19. cout <<"This is a Microwave. It has a wavelength between 0.010 meters and 1 meter";
  20. else if (Frequency >= 300000000000)
  21. cout <<"This is infrared radiation. It has a wavelength between 70 micrometers and 10 millimeters";
  22. else if (Frequency >= 400000000000000)
  23. cout <<"This is visible light, it has a wavelength betwixt 40 micrometers and 70 micrometers";
  24. else if (Frequency >= 750000000000000
  25. cout <<"This is ultraviolet radiation and has a wavelength between 100 micrometers and 40 micrometers";
  26. else if (Frequency >= 30000000000000000)
  27. cout <<"This is x-ray radiation and has a wavelength between 100 nanometers and 100 micrometers";
  28. else if (Frequency >= 30000000000000000000)
  29. cout <<"This is gamma radiation and has a wavelength below 100 micrometers";
  30. break;
  31. case 'w':
  32. cout << "input Wavelength";
  33. cin >> Wavelength;
  34. if (Wavelength >= 1)
  35. cout <<"This is a Radio wave, it has a Frequency under 3 nanohertz";
  36. else if (Wavelength <=1)
  37. cout <<"This is a Microwave. It has a frequency of above 3 nanohertz and below 300 nanohertz";
  38. else if (Wavelength <= 0.010)
  39. cout <<"This is infrared light, it's frequency is betwixt 300 nanoHertz and 400 picoHertz";
  40. else if (Wavlength <= 0.0000007)
  41. cout <<"This is visible light, it's frequency is betwixt 400 picoHertz and 750 picoHertz";
  42. else if (Wavlength <= 0.0000004)
  43. cout <<"This is an ultraviolet ray, it's frequency is betwixt 750 picoHertz and 30 femtoHertz";
  44. else if (Wavlength <= 0.00000010)
  45. cout <<"This is an x-ray, it's frequency is betwixt 30 femtoHertz and 30 attoHertz";
  46. else if (Wavlength <= 0.00000000010)
  47. cout <<"This is a gamma ray, it's frequency is above 30 attoHertz";
  48. break;
  49. default: cout << "Invalid entry" << endl;
  50. }
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement