// hw9_1.cpp // generates a counter based on the Number class, which uses the Digit class // the user chooses whether to count up or down #include using namespace std; #include #include "digit.h" #include "number.h" int main() { Number h; int num, choice; bool ok; cout << "Enter a number to start the counter at: "; cin >> num; // create a Number object from num (using the overloaded = operator) h = num; system("clear"); cout << h; // display the number (using overloaded << operator) do { cout << "Enter 1 for countup and 2 for countdown: "; cin >> choice; ok = (choice == 1 || choice == 2) ? true : false; } while ( !ok ); while(1) { system("clear"); (choice == 1) ? ++h : --h; cout << h; } cout << endl; return 0; }