AS. Thanks for sticking with me on this. I'm trying to understand. 
I think your missing my point and I"m missing yours.
Are you saying that C programming can not distinguish between a 0 or -0 (as a number) and there is no way to make my "wrong test" correct so it will distinguish between 0 and -0?
ie, when you enter "0" the program says "i is a positive 0" and when you enter "-0" the program says "i is a neg 0"
Yes, a C integer or a C double or a C float cannot store a value equal to "-0". when you write
-0 in C this is an expression made
by
unary operator minus and a
value of zero.
What a user input in your program is a
string made from
character ascii menus and
character ascii zerowhen your program perform this statement
scanf ("%lf",&i); it really does a
format conversion from string to double,
and the string "-0" is converted to a double of value 0.
Of course, it's possible to check for strings (i.e. strcmp(str_value, "-0") and in this case you can differentiate the string "0" from the string "-0" because
they are really different:
int main ()
{
char string_number[80]; // storage for string input
double i = 0; // storage for numeric value
printf ("Only enter -0, 0, -2, or 2. Enter \"quit\" to exit\n");
while (1) // will exit on "quit" test
{
scanf ("%s", string_number); // input strings
if (strncmp(string_number, "quit", 1) == 0) // test "quit" strings
break;
if (strcmp(string_number, "-0") == 0) // invalid input
{
printf ("i is a neg 0\n");
printf ("Invalid value\n");
continue;
}
else if (strcmp(string_number, "0") == 0)
printf ("i is a positive 0\n");
else if (strcmp(string_number, "-2") == 0)
printf ("j is a neg 2\n");
else if (strcmp(string_number, "2") == 0)
printf ("j is a positive 2\n");
else // invalid input
{
printf ("Can't obey the rules can you \?\n");
continue;
}
// here your input has been validated against your rules
sscanf(string_number, "%lf", &i);
printf("stored number is %lf\n", i);
}
return 0;
}
AS