POJ2121
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
#include<iostream>
#include<string>
using namespace std;
string s[]={
"negative", "zero", "one", "two",
"three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen",

该博客详细介绍了如何解决POJ2121编程问题,涉及将英语数字转化为整数的算法。内容包括处理负数、零以及从一到亿的英文数字单词,特别指出输入处理中的常见错误和注意事项,如 cin 不会读取换行符,以及使用临时变量处理million和thousand的情况。
最低0.47元/天 解锁文章
403

被折叠的 条评论
为什么被折叠?



