Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- float gr = pow(10, -11);
- float xr = pow(10, -8);
- float uv = 4e-007;
- float vl = 7e-007;
- float ir = pow(10, -3);
- float mw = pow(10, -2);
- float num1, num2, num3;
- string grs = " meter is a Gamma Ray";
- string xrs = " meter is a X ray";
- string uvs = " meter is a Ultra Violet";
- string vls = " meter is a Visible Light";
- string irs = " meter is a Infrared";
- string mws = " meter is a Microwaves";
- cout << "enter the wavelengths of three different electromagnetic waves in meters: " << endl;
- cin >> num1;
- cin >> num2;
- cin >> num3;
- string num1String = "The first electromagnetic wave with a wavelength of meter is a ";
- //FOR NUM 1
- if (num1 < gr)
- {
- cout << num1String << num1 << grs << endl;
- }
- if (num1 > gr && num1 < xr)
- {
- cout << num1String << num1 << xrs <<endl;
- }
- if (num1 > xr && num1 < uv)
- {
- cout << num1String << num1 << uvs <<endl;
- }
- if (num1 > uv && num1 < vl)
- {
- cout << num1String << num1 << vls <<endl;
- }
- if (num1 > vl && num1 < ir)
- {
- cout << num1String << num1 << irs <<endl;
- }
- if (num1 > ir && num1 < mw)
- {
- cout << num1String << num1 << mws <<endl;
- }
- if (num1 > mw)
- {
- cout << num1String << num1 << " meter is a Radio Waves" <<endl;
- }
- //for num 2
- if (num2 < gr)
- {
- cout << num1String << num2 << grs << endl;
- }
- if (num2 > gr && num2 < xr)
- {
- cout << num1String << num2 << xrs << endl;
- }
- if (num2 > xr && num2 < uv)
- {
- cout << num1String << num2 << uvs << endl;
- }
- if (num2 > uv && num2 < vl)
- {
- cout << num1String << num2 << vls << endl;
- }
- if (num2 > vl && num2 < ir)
- {
- cout << num1String << num2 << irs << endl;
- }
- if (num2 > ir && num2 < mw)
- {
- cout << num1String << num2 << mws << endl;
- }
- if (num2 > mw)
- {
- cout << num1String << num2 << " meter is a Radio Waves" << endl;
- }
- //FOR NUM 3
- if (num3 < gr)
- {
- cout << num1String << num3 << grs << endl;
- }
- if (num3 > gr && num3 < xr)
- {
- cout << num1String << num3 << xrs <<endl;
- }
- if (num3 > xr && num3 < uv)
- {
- cout << num1String << num3 << uvs <<endl;
- }
- if (num3 > uv && num3 < vl)
- {
- cout << num1String << num3 << vls <<endl;
- }
- if (num3 > vl && num3 < ir)
- {
- cout << num1String << num3 << irs <<endl;
- }
- if (num3 > ir && num3 < mw)
- {
- cout << num1String << num3 << mws <<endl;
- }
- if (num3 > mw)
- {
- cout << num1String << " meter is a Radio Waves" <<endl;
- printf ("%.3f", num3);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement