Unexpected Output and Warning
I am just playing around with what I have learned so far, up to the naming convention of variables. So I don't understand what I am doing wrong with the if/else. It doesn't seem to evaluate what I have in prens, plus I get this warning message in Code:Blocks: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]| #include <iostream> using namespace std; int main() { string PlantName; //Pascal naming convention bool plantState; //Camel naming convention cout << "\n"; cout << "Please enter the plant name: "; cin >> PlantName; cout << "\n"; cout << "Is " << PlantName << " yellow and limp? [1=Yes:0=No]: "; cin >> plantState; if (plantState=1) { cout << "\n"; cout << "Give " << PlantName << " some water." << endl; cout << "\n"; } else { cout << "\n"; cout << "Water " << PlantName << " every 2 days." << endl; } return 0; }