There are a number of ways of tackling this; one way is to use switch(n) with
case: 0: case:1 //etc through 9
Typically
-
switch(n){
-
case: 0;
-
cout<<"zero";break;
-
// the remaining cases follow on here
-
}
-
You could also use
- if(n==1)fprint("one");
-
else if(n==2)fprint("two");
In your case you might place your individual digits of the integer in a container such as an array or vector and then use a for loop to direct each array element to the switch() and case: statements