Try this:

Code:

#include <iostream>
char numbers[][10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
char numbers2[][10]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eightteen","nineteen"};
char numbers3[][10]={"","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
void units(int u);
int main(){
units(983);
std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
}
void units(int u){
if(u==0){
std::cout<<numbers[0];
return;
}
int nums[3]={0,0,0};
bool plusand=false;
nums[0]=(u/100)%10;
nums[1]=(u/10)%10;
nums[2]=u%10;
for(int x=0;x<3;x++){
if(nums[x]>0){
if(plusand){
std::cout<<"and ";
plusand=false;
}
if(x==0){
std::cout<<numbers[nums[0]]<<" hundred ";
plusand=true;
}
else if(x==1){
if(nums[1]==1){
std::cout<<numbers2[nums[2]];
break;
}
else{
std::cout<<numbers3[nums[1]]<<" ";
}
}
else{
std::cout<<numbers[nums[2]];
}
}
}
return;
}