hello... I am trying to convert 2 digit numbers to words: example 11= eleven. I saw some other entries on this but they dont include case or switch
so far I have:
#include <iostream>
using namespace std;
cout<<"Enter a two-digit number: ";
cin>>number;
if(number>99)
{
cout<<"Number out of range";
exit(0);
}
if(number==0)
{
cout<<"Zero";
exit(0);
}
temp=number;
digit=number%10;
last_two=digit;
number=number/10;
digit=number%10;
last_two=(digit*10)+last_two;
while(temp!=0)
{
temp=temp/10;
digit++;
}
cout<<"You have entered the number ";
int num;
{
switch(num)
{
case 0: break;
case 1: cout<<"One ";
break;
case 2: cout<<"Two ";
break;
case 3: cout<<"Three ";
break;
case 4: cout<<"Four ";
break;
case 5: cout<<"Five ";
break;
case 6: cout<<"Six ";
break;
case 7: cout<<"Seven ";
break;
case 8: cout<<"Eight ";
break;
case 9: cout<<"Nine ";
break;
case 10: cout<<"Ten ";
break;
case 11: cout<<"Eleven ";
break;
case 12: cout<<"Twelve ";
break;
case 13: cout<<"Thirteen ";
break;
case 14: cout<<"Fourteen ";
break;
case 15: cout<<"Fifteen ";
break;
case 16: cout<<"Sixteen ";
break;
case 17: cout<<"Seventeen ";
break;
case 18: cout<<"Eighteen ";
break;
case 19: cout<<"Nineteen ";
break;
}
return;
}
can someone help?