//This is code for lab9, CISC1600, Spring 2013 //An unfinished code that implements printing a // number in English: 32 will print as thirty two // Please carry out the lab based upon the order specified in // requirement #include #include using namespace std; //precondition: num is between 0 and 9 //postcondition: the english name of num is displayed in terminal void PrintOnes (int num); //precondition: num is between 11 and 19 //postcondition: the english name of num is displayed in terminal void PrintTeen (int num); //precondition: num is 10, 20, ..., and 90 //postcondition: the english name of num is displayed in terminal void PrintTens (int num); void PrintNumber (int); int main() { int number = 0; cout << "Enter a number "; cin >> number; PrintNumber(number); } // precondition: num has a value between 0 and 999 // postcondition: the English name of the num is displayed in terminal (standard output) void PrintNumber (int num) { cout <<"PrintNumber " << num << "\n \n"; assert (num<=999); // divide the numbers by relevant digits to get the relevant answers int hundred = num /100 ; int tens = (num % 100); int ones = (num % 10 ); //putting up a condition to only display hundred if it is completly divisible by 100 if (hundred > 0) { PrintOnes(hundred); cout << " Hundred "; } // printing out the teens in the similar manner if ((tens > 10)&& (tens < 20)) { PrintTeen(tens); //setting tens to zero because there is no need for it anymore tens = tens - tens; ones = ones - ones; } //if it not teens than start displaying tens by minusing the ones tens = tens - ones ; if ((tens == 10)|| (tens > 19)) PrintTens (tens); if (ones > 0) { PrintOnes (ones); } cout <