Welcome to Lab 7. We're working on...functions. So for this lab we are going to write two simple functions and then use them in our main lab function.
In this lab we are going to read in a command and then decide what to do. There are two commands that we will work on.
string convertNumber( int number );
Converted from Number to String Number: String:After the word "Number: " there should be the number that was entered: e.g. 1. After the word "String: " there should be the string, e.g. "one".
toNumber
int convertString( string word );
Converted from String to Number String: Number:After the word "Number: " there should be the number that was entered: e.g. 1. After the word "String: " there should be the string, e.g. "one".
For both of these functions we are only working with the numbers 0-9. If the number given to convertNumber is not between 0 and 9, then return the string "error". If the word given to convertString isn't, "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", or "nine", then return -1.
The following is a sample input:
toString 7 toNumber four
so your lab should run until the input fails.
If your program was run using the input above your program would ouput this:
Converted from Number to String Number: 7 String: seven Converted from String to Number String: four Number: 4
In order for this lab to work, you must do the following:
Like all labs, this is due at the end of lab. Tuesday, October 14 at 6:50. I will accept this for an additional 65 hours, or until 11:50AM on Friday
When you are done, zip up your convert.h file and implementation file(s) and turn them into Web-CAT.