#include <
stdlib.h>
#include <
stdio.h>
using namespace std;
int n;
int main()
{
scanf("%d", &n);
int v = n/100;
if (v == 9) printf("Nine hundred");
else if (v == 8) printf("Eight hundred");
else if (v == 7) printf("Seven hundred");
else if (v == 6) printf("Six hundred");
else if (v == 5) printf("Five hundred");
else if (v == 4) printf("Four hundred");
else if (v == 3) printf("Three hundred");
else if (v == 2) printf("Two hundred");
else if (v == 1) printf("One hundred");
if (!(n%100))
{
printf(".\n");
return 0;
}
printf(" and ");
v = (n/10)%10;
if (v == 9) printf("ninety ");
else if (v == 8) printf("eighty ");
else if (v == 7) printf("seventy ");
else if (v == 6) printf("sixty ");
else if (v == 5) printf("fifty ");
else if (v == 4) printf("forty ");
else if (v == 3) printf("thirty ");
else if (v == 2) printf("twenty ");
if (v == 1)
{
v = n%10;
if (v == 9) printf("nineteen");
else if (v == 8) printf("eighteen");
else if (v == 7) printf("seventeen");
else if (v == 6) printf("sixteen");
else if (v == 5) printf("fifteen");
else if (v == 4) printf("fourteen");
else if (v == 3) printf("thirteen");
else if (v == 2) printf("twelve");
else if (v == 1) printf("eleven");
else if (v == 0) printf("ten");
}
if ((n/10)%10 != 1)
{
v = n%10;
if (v == 9) printf("nine");
else if (v == 8) printf("eight");
else if (v == 7) printf("seven");
else if (v == 6) printf("six");
else if (v == 5) printf("five");
else if (v == 4) printf("four");
else if (v == 3) printf("three");
else if (v == 2) printf("two");
else if (v == 1) printf("one");
}
printf(".\n");
return 0;
}
幸苦打的,望采纳
追问谢谢你
追答不用谢
追问哥,10位是1的时候,
是这样表示么,,
比如,214
应该是 Two hundred and fourteen. 吧
哥.....在嘛……
追答我的程序没有错呀。我测试过214的
另外,我交给你的代码曾经修改过一次,你看看是不是拿了我修改前的代码了。
追问呀,对了⊙▽⊙
谢谢了,
话说您用的什么软件这是?
追答DevC++ 5.9.2
这玩意这不是这么好找的哦!有点贵。
追问好嘛好嘛,,
谢谢咯,
新年快乐~
追答……谢谢