C语言编写数字输出问题

来源:百度知道 编辑:UC知道 时间:2024/06/01 09:33:36
用C语言编写一个程序,程序的要求是:输入一个数字,数字的范围在0到2,000,000,000之间,然后用英文输出。例如:输入1234011811,输出是:One billion, two hundred and thirty four million, eleven thousand, eight hundred and eleven.
输出的第一个字母要大写,结束要有句号,中间有逗号隔开。

诚心教代码如何编写,要求用C语言。万分感谢。分数必定追加

分太少。给你个idea. 输出 0-99 的方法。大于它的 按 L 判断(你自己写)。大小写尚未考虑。
#include <stdio.h>
#include <stdlib.h>

void main()
{
char s[12];
int d,c,b,a;
char num[20][10]={"zero","one","two","three","four","five","six","seven","eight",
"nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen",
"seventeen","eighteen","ninteen"};
char nty[9][10] = { "ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninty"};

int L;
printf("input int number between 0 and 2000000000\n");
scanf("%s",s);
L = strlen(s);
if (L <= 2)
{
sscanf(s,"%d",&a);
if ( a /