// Dave Goldsmith // Redwood High School // C++ Computer Programming // May 3, 2009 // StringToInteger1.cpp #include #include #include #include using namespace std; int StringToInteger(string wordNum) // This function takes a string (wordNum) and converts it to (and returns) an integer. // If the string is blank or has any non-numeric characters, a zero (0) is returned. // Note that the FIRST character of the string is not checked for being a digit; this // allows a negative integer (one that begins with a "-") to be entered; if the first // character is a non-digit other than a "-", then the 'atoi()' function will return 0. { for (int i=1; i> wordNum; number = StringToInteger(wordNum); cout << "\nThe integer value of your entry is " << number << ".\n\n"; }