I just started to learn C++ 2 days ago. I am just learning the basic syntax now. I just learned if statements, and i was trying to practice them. My problem is that at the "if(temp >= 60 && temp <= 70)" and "if(temp >= 75)" parts of the code, I get the error no match for 'operator' error. I tried looking this up. people with similar problems are using code that i simply cannot follow. I tried implementing their solutions, but i get even more error messages.If someone could please help, i would appreciate it, because i don't know anyone in real like that knows C++ or even anyone that codes. Thanks in advance.Here is the code. Sorry if its messy:
#include <iostream>
#include <string>
using namespace std;
int main()
{
//Get seed color
string seedColor = "";
cout << "Enter seed color (Red or Blue): \n";
cin >> seedColor;
//Get Temperature
string temp = "";
cout << "Enter the temperature (F): \n";
cin >> temp;
//Get soil moisture
string soilMoisture = "";
cout <<"Enter the soil moisture (wet or dry): \n";
cin >> soilMoisture;
//if red seed
if(seedColor == "red")
{
//if temp is >= 75
if(temp >= 75)
{
//if soil is wet
if(soilMoisture == "wet")
{
//get sunflower
cout << "A sunflower grew!";
}
//if soil is dry
else
{
//get dandelion
cout << "A dandelion grew!";
}
}
else
{
//otherwise
//get mushroom
cout << "A mushroom grew!";
}
}
//if blue seed
if(seedColor == "blue")
{
//if temp is between 60 and 70
if(temp >= 60 && temp <= 70)
{
//if soil is wet
if(soilMoisture == "wet")
{
//get dandelion
cout << "You grew a dandelion!";
}
else
{
//if soil is dry
cout << "You grew a sunflower!";
//get sunflower
}
}
else
{
//Otherwise
cout<< "You grew a mushroom!";
//Mushroom
}
} }