估计楼主是不知道怎么定义吧?写了下你看看:
#include <stdio.h>
main()
{char decade[11][20]={"
","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
char denum[11][20]={"
","one","tow","three","four","five","six","seven","eight","nine"};
int n,hundreds,tens,unit;
printf("请输入一个小于1000的整数: ");
scanf("%d",&n);
if(n>=1000)
{
printf("Error!Rewrite again:
");
scanf("%d",&n);
}
if(n>99)
{hundreds=n/100;
tens=(n/10)%10;
unit=n%10;
if(tens==0&&unit==0)
printf("%d is %s hundreds\n",n,denum[hundreds]);
else
printf("%d is %s hundreds and %s
%s\n",n,denum[hundreds],decade[tens],denum[unit]);
}
else if(n>9)
{tens=n/10;
unit=n%10;
printf("%d is
%s
%s\n",n,decade[tens],denum[unit]);
}
else printf("%d is
%s\n",n,denum[n]);
}