|
|
Degree (F): 32 Wind speed (MPH): 32 At least one value is out of range! Ranges are: - Temperature (-45 - 45) - Wind speed (3 - 60) in increments of 5 Press any key to continue . . . |
Wind Speed Temperature 32 32 25 50 46 40 61 60 15 15 0 |
32 32 25 50 46 40 61 60 15 15 0 |
Degree (F): 32 Wind speed (MPH): 32 At least one value is out of range! ... |
cout << " At least one value is out of range!\n" << " Ranges are:\n" << " - Temperature (-45 - 45)\n" << " - Wind speed (3 - 60) in increments of 5\n" << endl; |
cout << " Degree (F): "; cin >> degree; cout << " Wind speed (MPH): "; cin >> mph; if ((degree < -45 || degree > 45) || (mph < 3 || mph > 60 || mph % 3 != 0)) |
degree = 32; mph = 32; ............................................. degree < -45 (32 < -45) - Wrong !!! degree > 45 (32 > 45) - Wrong !!! mph < 3 (32 < 3) - Wrong !!! mph > 60 (32 > 60) - Wrong !!! mph % 3 != 0 (32 % 3 = 2) - Right !!! Then output is : [quote] cout << " At least one value is out of range!\n" << " Ranges are:\n" << " - Temperature (-45 - 45)\n" << " - Wind speed (3 - 60) in increments of 5\n" << endl; |
mph % 3 != 0 |