谁能帮小弟解答一道C语言题目 小弟是菜鸟 Write a program that takes an integer keyed in from the terminal and extracts and displays each digit of the integer in English.So,if the user types in 932,the program should display:nine three
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 17:34:32
谁能帮小弟解答一道C语言题目 小弟是菜鸟 Write a program that takes an integer keyed in from the terminal and extracts and displays each digit of the integer in English.So,if the user types in 932,the program should display:nine three
谁能帮小弟解答一道C语言题目 小弟是菜鸟
Write a program that takes an integer keyed in from the terminal and extracts and displays each digit of the integer in English.So,if the user types in 932,the program should display:
nine three two
Remember to display "zero" if the user types in just a 0.
This exercise is non simple,so make sure that you have worked out your algorithm in advance.
谁能帮小弟解答一道C语言题目 小弟是菜鸟 Write a program that takes an integer keyed in from the terminal and extracts and displays each digit of the integer in English.So,if the user types in 932,the program should display:nine three
首先要建立数字0-9和英文”zero“-”nine“的对应关系
然后,一个int数组,存放输入的int的各个数字
然后用输入的那个int不停的除以10,取余,结果放进数组里,再除以10……
直到输入的int为0.另外输入为0的单独处理
依次从数组末尾取出数字转换成鸟文输出到屏幕上
偷懒的方法就是输入的时候你不存成一个int,而直接存在数组里……