// Mr. Minich // Computer Science Using C++ // Ch. 5 Demo Program #7 // January 30, 2000 // Purpose - to parse the digits in a number #include <iostream.h> int main() { int num = 0; int position = 0; int nextDigit = 0; int onesDigit = 0; int tensDigit = 0; int hunsDigit = 0; int thousDigit = 0; cout << "Enter a number: "; cin >> num; onesDigit = num % 10; num /= 10; tensDigit = num % 10; num /= 10; hunsDigit = num % 10; num /= 10; thousDigit = num % 10; cout << "The ones digit is " << onesDigit << endl; cout << "The tens digit is " << tensDigit << endl; cout << "The hundreds digit is " << hunsDigit << endl; cout << "The thousands digit is " << thousDigit << endl; return 0; }// end of main