How to error check that input is int or something else

Hi, here is my problem. I have to make a program that determines the distance between 2 points of latitude and longitude. I've done all that, but I'm having a problem with the error checking. The first location is supposed to be enter with a space between the latitude and longitude (34 151). A negative in front of the number denotes south or west for latitude and longitude. So if i enter (34 abc), it thinks that abc is a number and calculates something and i get a non-garbage output. How would I put an error checking feature into my program so it would says that "abc" is a bad input?

Just a suggestion

Why don't you create a string variable (character array), accept the input initially into it, verify that the array consists of digits or spaces only. If it contains any other symbol, you know that an error has occured (the data is invalid).