CPS 100E: Groupwork # 1:
Numbers in English and Talking Cash Registers


Write Group Member Names in the space below










Overview

Form groups of size 3-4 persons. DO NOT WORK ALONE. Start this group activity by introducing each member of the group. One group member should be the scribe, this person is responsible for recording the group's endeavors. You'll need to turn in a writeup for the group activity, the scribe is responsible for writing each group member's name on the writeup.

You'll work some on the last part of what we did in lab on Thursday, September 5 (Lab 1). You'll also think about how to modify the program numtoeng.cc in a different way than what is required for the lab.


Looping for Input

The function main() from numtoeng.cc is reproduced below. Write a new version of the function that repeatedly prompts the user for a number and prints the number in English. The loop should stop when the number entered is outside the range [0..99] (this is from today's lab). Write constant definitions for 0 and 99 rather than using numeric literals. Sketch your loop solution in the space below the code. int main() { int number; cout << "enter number between 0 and 99: "; cin >> number; cout << number << " = " << NumToString(number) << endl; return 0; }

Speaking Numbers

Assume there is a function with the prototype below that will "speak" a number represented as a string using a computer's speaker. This might be used for a talking cash register or for speaking phone numbers automatically when using directory assistance.

void SpeakNumber(string number) // precondition: number is the English equivalent of 1,2, ..., 16, 30, 40 // i.e., "two", "sixteen", "thirty" // postcondition: sound is generated to speak number Describe in a few sentences what functions in numtoeng.cc need to be modified and how to modify them so taht the function SpeakNumber is used instead of using cout << ... to print the numbers.