程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> lines-Inglish-Number Translator

lines-Inglish-Number Translator

編輯:編程解疑
Inglish-Number Translator

Description
In this problem, you will be given one or more integers in English. Your task is to translate these numbers into their integer representation. The numbers can range from negative 999,999,999 to positive 999,999,999. The following is an exhaustive list of English words that your program must account for: negative, zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million
Input
The input consists of several instances. Notes on input:
Negative numbers will be preceded by the word negative.
The word "hundred" is not used when "thousand" could be. For example, 1500 is written "one thousand five hundred", not "fifteen hundred".
The input is terminated by an empty line.
Output
The answers are expected to be on separate lines with a newline after each.
Sample Input
six
negative seven hundred twenty nine
one million one hundred one
eight hundred fourteen thousand twenty two

Sample Output
6
-729
1000101
814022

最佳回答:


http://wenku.baidu.com/link?url=yCFJLb51ptOOfhpVc6xbAUArX6pfhMgrfMFeoFcjUEHjfilLQ4HtkbAdLqPLNVrAvMdkSfAtSutv-Zlg2LSKJ_aae8LbD1Z8QC-szq0OWLG

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved