我制作了一个程序,用印数字格式将数字从整数转换为英文,我不确定如何将其转换为国际系统?
#include<stdio.h>
#include<conio.h>
void convert(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};
void main()
{
long n;
clrscr();
printf("Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
convert((n/10000000),"crore");
convert(((n/100000)%100),"lakh");
convert(((n/1000)%100),"thousand");
convert(((n/100)%10),"hundred");
convert((n%100)," ");
}
getch();
}
void convert(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}