Advertisement
Guest User

Summer_Outfit_ Nested Conditionals

a guest
Feb 2nd, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int degree;
  8.     cin >> degree;
  9.     string textWeatherOfDay,outfit,shoes ;
  10.     cin >> textWeatherOfDay;
  11.    
  12.    
  13.  
  14.     if (textWeatherOfDay == "Morning") {
  15.      
  16.         if (degree >= 10 && degree <= 18) {
  17.             outfit == "Sweatshirt";
  18.             shoes == "Sneakers";
  19.         }
  20.         else if (degree >= 18 && degree <= 24) {
  21.             outfit == "Shirt";
  22.             shoes == "Moccasins";
  23.         }
  24.         else if (degree >= 25) {
  25.             outfit == "T-Shirt";
  26.             shoes == "Sandals";
  27.         }
  28.     }
  29.     if (textWeatherOfDay == "Afternoon") {
  30.         if (degree >= 10 && degree <= 18) {
  31.             outfit == "Shirt";
  32.             shoes == "Moccasins";
  33.         }
  34.         else if (degree >= 18 && degree <= 24) {
  35.             outfit == "T-Shirt";
  36.             shoes == "Sandals";
  37.         }
  38.         else if (degree >= 25) {
  39.             outfit == "Swim Suit";
  40.             shoes == "Barefoot";
  41.         }
  42.      
  43.         if (textWeatherOfDay == "Evening") {
  44.             if (degree >= 10 && degree <= 18) {
  45.                 outfit == "Shirt";
  46.                 shoes == "Moccasins";
  47.             }
  48.             else if (degree >= 18 && degree <= 24) {
  49.                 outfit == "Shirt";
  50.                 shoes == "Moccasins";
  51.             }
  52.             else if (degree >= 25) {
  53.                 outfit == "Shirt";
  54.                 shoes == "Moccasins";
  55.             }
  56.            
  57.         }
  58.        
  59.        
  60.     }
  61.         cout.setf(ios::fixed);
  62.         cout.precision(2);
  63.         cout << "It's " << degree << " degrees, get your " << outfit << "and " << shoes << "." << endl;
  64.      
  65.          
  66.         return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement