Cin>> for Water Plant

Hi,

So I’m trying out some different options for the final output of the Water Plant exercise. I want to be able to use user-input for the amount of days and for whether or not the plant is a succulent. However, when using std:cin >>, it’s passing by the user input and going straight to the output. Why is that? I noticed it previously when I tried it there (just a few exercises back). Here’s what I roughly have:

#include <iostream>

// Define needs_water() here:
std::string needs_water(int days, bool is_succulent) {
  
  if (days > 3 && is_succulent == false) {
    return "Time to water the plant.";
  } else if (days < 13 && is_succulent) {
    return "Don't water the plant!";
  } else if (days >= 13 && is_succulent) {
    return "Go ahead and give the plant a little water.";
  } else {
    return "Don't water the plant!";
  }
  
}

int main() {
  
  int i;
  bool is_succ;
    
  std::cout << "How many days ago did you water it?\n";
  std::cin >> i;
  
  std::cout << "Is it a succulent? (Enter 0 for No, 1 for Yes)\n";
  std::cin >> is_succ;
  
  std::cout << needs_water(i, is_succ) << "\n";
  
}

Any help would be appreciated in understand what’s going on.

Thanks.

The program appears to be working as intended when I run it.
Can you elaborate what it is that you don’t expect, or if what you expect, that isn’t happening

Edit: I just ran it through a different compiler and it worked fine. It was only when running it through the Codecademy terminal that it was bypassing everything.

Well, as I had mentioned, it’s bypassing the user input I was expecting when using std::cin >>. Instead of me being able to enter in the days and true/false for whether it’s a succulent, it’s going straight to the else statement of “Don’t water the plant.”