Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

c - 将数字转换为数组中的单词(Converting numbers to words in array)

I need to convert numbers to words in array, that we print from keyboard(array include other words too)

(我需要将数字转换为数组中的单词,这些单词是我们从键盘打印的(数组中也包含其他单词))

As an example .

(举个例子 。)

Input text: I have 2 apples.

(输入文字:我有2个苹果。)

Output : I have two apples/How to do it ?Or how it write by using itoa?

(输出:我有两个苹果/如何做?或者如何使用itoa来写?)

#include <stdio.h>
#include <stdlib.h>
#define MAX 170
int main(void) {
    const char* fkr[10] = { "zero" ,"one", "two", "three", "four", "five", "six","seven","eight","nine" };
    char* fk, ar;
    char afk[MAX] = {};
    gets_s(afk);
    return 0;
}
  ask by Apobia translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can find here a simple program that converts digits into words.

(您可以在这里找到一个简单的程序,将数字转换成单词。)

It is based on a switch with 10 cases (from 0 to 9), which is very simple.

(它基于具有10种情况(从0到9)的开关,这非常简单。)

If you need something more complex, to transform numbers, not digits, into words, then look here .

(如果您需要更复杂的东西来将数字而不是数字转换成单词,请看这里 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...