I have to be able to sort negative zeros and zeros for an assignment i am doing at university using c++, could someone tell me why the following code does produce a negative zero? i'm stuck and i am not sure why this works...
cout << "Enter the number of elements you want to add to the vector:\n";
cin >> x;
cout << "Enter the integers: \n" << endl;
for (int i = 0; i < x; i++)
{
cin >> y;
y = y - 0.0;
cout << y;
Array.push_back(y);
}
If there is a better way of producing a negative zero when sorting the above vector please advise. Many thanks!