Question: Is it possible to assign the values of the different service levels in the tip() function under the service variable as I've started to do below? I know the alternative and likely preferred solution is to assign these values to the option values but would like to know if it can be done with if statements too.

```js
function tip() {

  var tipp = document.getElementById("bill").value;
  var split = document.getElementById("billsplit").value;
  var service = document.getElementById("service").value; //good=.3,ok=.25,bad=.2
  if service = "Good" {
    document.getElementById = ("service").innerHTML = .3;
  }

  document.getElementById("result").innerHTML = (tipp * service) / split;

}
```

```html
Enter Total Bill<br><br>
<input type="number" name="bill" id="bill">
<br><br> How was the Service <br><br>
<select id="service">
  <option value="Good">Good</option>
  <option value="Bad">Bad</option>
  <option value="ok">ok</option>
</select>

<br><br> How many People are sharing Bill?<br><br>

<input type="number" name="billsplit" id="billsplit">

<button type="button" onclick="tip()">CALCULATE</button>

<br><br>Result : <span id="result"></span>
```

Answer: 
I guess you could do it like this if you absolutely have to make an overloaded `operator==`.

```
bool operator==(const StudentGradeInfo& sgi, int id) {
    return sgi.studentID == id; 
}

std::vector<StudentGradeInfo> gradebook;
int id_to_find=1234;

for(auto& sgi : gradebook) {
    if(sgi==id_to_find) {
        //...
    } 
}

```
I suppose you want to loop through the vector to find a studentGrandeInfo-object with a particular ID. You can accomplish this rather easy by using `std::find_if` together with a lambda-function for the proper comparison. The code could look as follows:

```
int toFind = 4219; // some ID
auto it = std::find_if(
gradebook.begin(), gradebook.end(),
[&toFind](const StudentGradeInfo& x) { return x.studentID == toFind;});

```

In your case, as you the `studentID` seems to serve as a "unique key", I'd use data structure `std::map<int, StrudentGradeInfo>` instead.

Overloading operator `==` is - as gsamars pointed out - somehow impractical, as it is meant for comparing two objects of the same type (and not an object with an int). See the following code illustrating this:

```
struct StudentGradeInfo {
    std::string studentName;
    int studentID;

    bool operator==(const StudentGradeInfo& c) const {
        return c.studentID == studentID;
    }
};

int main() {

    std::vector<StudentGradeInfo> gradebook {
        { "john", 123 },
        { "max", 345 }
    };

    StudentGradeInfo aNewOne { "sepp", 345 };
    auto it = find(gradebook.begin(),gradebook.end(),aNewOne);
    if (it == gradebook.end()) {
        cout << "345 does not exist" << endl;
    } else {
        cout << "345 already exists" << endl;
    }

}

```