I can use this to get positive numbers from the user easily.Code:
But say I also want the user to enter negative numbers, like "-10."
Obviously I would have to check and see if the first character is a "-" or not, then get whatever the integer after the "-" is.
I'm not sure whether scanf can be used to scan characters and integers at the same time. Is it possible, or should I use a different function?