## combining/writing FUNCTIONS

C++ programmers:
Before I begin, let me tell what my program is all about. I'm writing a random
# guessing game that says the inputed numerical value. For example, if a
user guess the number to be 6, the game will say 6 in return and tell if
it's correct. Since I have a limited amount of wav files to use (zero, one,
two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thir,
teen, ty, twenty, hundred, thousand, and million), I need to combine some
to produce the correct spoken number. What I mean is, if a user types in
65, the game has to say "six" + "ty" + "five" to pronunce 65 correctly.

However, here comes my problems....

(1) I'm stuck writing function2 that should be able to say any number from
1 to 99. Since I've already wrote function1 that is abe to say any number
1 to 9,
I know that I can combine it with function2, but I don't know how.

(2) I don't know how to code in numbers such as 45, 67, and 33. I know that
I can use integer division and mod operator to split up digits, but I still
don't have
a clue of how to code it.

In closing, please HELP. Also keep in mind that I'm a true beginner at C++.

Thanks in advance!
.jurge

//B-E-G-I-N P-R-O-G-R-A-M D-E-S-C-R-I-P-T-I-O-N//This is a random number
guessing game based on a popular prime time game show,//"Who Wants to be
a Millionaire?" The game prompts a user to guess a number ranging//from
1 to 1 million, and in return, it will say such things as "the number is
too high", "the //number is too low", "bingo, you got in right on the money"
and (my personal favorite) "is//"that your final answer?". Since these lines
are spoken by the game, DirectX is in use.//E-N-D P-R-O-G-R-A-M D-E-S-C-R-I-P-T-I-O-N#include
"GraphicsMachine.h"#include "GMDefines.h"GMMachine Machine;void NumbersOneToNine(int
number); //function1 prototypevoid NumbersOneToNintynine (int number); //function2
prototypeint PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine,
int nWinMode){ if (Machine.Start("Hello Program", hInst, nWinMode))
try { //a short, basic program to see if functions works or not. //it
will be replaced later by the random guessing game int number; do {
cin >> number; NumbersOneToNine(number); } while (number != 0);
} catch (GMExit){}; return Machine.ReturnValue;}//function1: receives
an integer ranging from 1 to 9 and it plays the appropriate//wav file. the
2nd paramater, which in this case is 2, tells the computer to wait//until
a sound is done playing before continuingvoid NumbersOneToNine(int number){
if (number == 1) { Machine.PlayWave("c:\\directXapp\\sound\\One.wav",2);
//source of wav file } else if (number == 2) { Machine.PlayWave("c:\\directXapp\\sound\\Two.wav",2);
} else if (number == 3) { Machine.PlayWave("c:\\directXapp\\sound\\Three.wav",2);
} else if (number == 4) { Machine.PlayWave("c:\\directXapp\\sound\\Four.wav",2);
} else if (number == 5) { Machine.PlayWave("c:\\directXapp\\sound\\Five.wav",2);
} else if (number == 6) { Machine.PlayWave("c:\\directXapp\\sound\\Six.wav",2);
} else if (number == 7) { Machine.PlayWave("c:\\directXapp\\sound\\Seven.wav",2);
} else if (number == 8) { Machine.PlayWave("c:\\directXapp\\sound\\Eight.wav",2);
} else if (number == 9) { Machine.PlayWave("c:\\directXapp\\sound\\Nine.wav",2);
} }//function2: receives an integer ranging from 1 to 99 and it plays the
appropriate//wav file. this function works in conjuction with function1
because it will borrow saying//the ones digits. for example, when the computer
says "fiftyfive", "five" will be borrowed//from function1 and "fif" and
"ty" are located here.void NumbersOnetoNintynine (int number){ int tens =
number / 10; //used to combine sounds. it seperates the ten digits. int
ones = number % 10; //used to combine sounds. it seperates the ones digits.
if (number == 10) { Machine.PlayWave("c:\\directXapp\\sound\\Ten.wav",2);
} else if (number == 11) { Machine.PlayWave("c:\\directXapp\\sound\\Eleven.wav",2);
} else if (number == 12) { Machine.PlayWave("c:\\directXapp\\sound\\Twelve.wav",2);
} //and so on......}