Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double frequency, wavelength;
- char choice;
- cout <<"Do you want to input Frequency 'f' or Wavelength 'w' ?" << endl;
- cin >> choice;
- switch (choice)
- {
- case 'f':
- cout << "input frequency /n";
- cin >> frequency;
- if (Frequency <= 0.000000003)
- cout <<"This is a Radio wave, it has a wavelength of over one nanometer";
- else if (Frequency >= 3000000000)
- cout <<"This is a Microwave. It has a wavelength between 0.010 meters and 1 meter";
- else if (Frequency >= 300000000000)
- cout <<"This is infrared radiation. It has a wavelength between 70 micrometers and 10 millimeters";
- else if (Frequency >= 400000000000000)
- cout <<"This is visible light, it has a wavelength betwixt 40 micrometers and 70 micrometers";
- else if (Frequency >= 750000000000000
- cout <<"This is ultraviolet radiation and has a wavelength between 100 micrometers and 40 micrometers";
- else if (Frequency >= 30000000000000000)
- cout <<"This is x-ray radiation and has a wavelength between 100 nanometers and 100 micrometers";
- else if (Frequency >= 30000000000000000000)
- cout <<"This is gamma radiation and has a wavelength below 100 micrometers";
- break;
- case 'w':
- cout << "input Wavelength";
- cin >> Wavelength;
- if (Wavelength >= 1)
- cout <<"This is a Radio wave, it has a Frequency under 3 nanohertz";
- else if (Wavelength <=1)
- cout <<"This is a Microwave. It has a frequency of above 3 nanohertz and below 300 nanohertz";
- else if (Wavelength <= 0.010)
- cout <<"This is infrared light, it's frequency is betwixt 300 nanoHertz and 400 picoHertz";
- else if (Wavlength <= 0.0000007)
- cout <<"This is visible light, it's frequency is betwixt 400 picoHertz and 750 picoHertz";
- else if (Wavlength <= 0.0000004)
- cout <<"This is an ultraviolet ray, it's frequency is betwixt 750 picoHertz and 30 femtoHertz";
- else if (Wavlength <= 0.00000010)
- cout <<"This is an x-ray, it's frequency is betwixt 30 femtoHertz and 30 attoHertz";
- else if (Wavlength <= 0.00000000010)
- cout <<"This is a gamma ray, it's frequency is above 30 attoHertz";
- break;
- default: cout << "Invalid entry" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement