I don't know why theCount
is returning 1
and not 2
. It's like it doesn't think that the x
and y
are equal. I'm really stumped and need some help.
double num = 0.2;
list<double> myList = {};
for (int i = 0; i < 6; i++)
{
num = num * 2;
myList.push_back(num);
if (num >= 1) {
num = num - 1;
}
}
cout << endl << "The List: ";
for (auto const j: myList) {
cout << j << " ";
} cout << endl;
int theCount = 0;
cout << endl;
for (double x: myList) {
for (double y: myList) {
cout << x << " & " << y << ", ";
if (x == y) {
theCount++;
}
}
cout << "-- theCount: " << theCount << endl;
theCount = 0;
} cout << endl;
return 0;