InterSol For Milk Measurement

// Change production values based on input as mentioned previously.
		cows[get<1>(list[i])] += get<2>(list[i]);
		if (get<1>(list[i]) == "Bessie")
		{
			cows["Bessie"] += get<2>(list[i]);
		}
		else if (get<1>(list[i]) == "Mildred")
		{
			cows["Mildred"] += get<2>(list[i]);
		}
		else if (get<1>(list[i]) == "Elsie")
		{
			cows["Elsie"] += get<2>(list[i]);
		}

In this section of the internal solution, isn’t the value getting added twice? once in this statement:

cows[get<1>(list[i])] += get<2>(list[i]);

And once again in the if statements?

I tried removing this statement and testing the code and it still works so is this just a mistake?

1 Like

You’re right.